这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dkramer95
Copy link
Contributor

@dkramer95 dkramer95 commented May 28, 2018

* New Widgets: Date, Time, Spinner, Text-To-Speech, Confirmation, BottomSheet, Radio, Counter, CheckBox
* Results are returned as JSON including code of button pressed

@dkramer95
Copy link
Contributor Author

dkramer95 commented May 28, 2018

This PR implements these feature requests:

It also adds the ability to use speech to text as an InputMethod!

The DialogActivity has been redone to make it easier to extend and add new InputMethod types in the future.

Feedback is appreciated... I submitted a PR for the accompanying termux-dialog script, though it is NOT complete... It's more of a POC to use the new commands in this PR but needs additional work such as better validating of options for certain widget types.. For now invalid options are simply ignored.

@fornwall
Copy link
Member

I will have a look at this, looks interesting!

@Neo-Oli What do you think about this?

@Neo-Oli
Copy link
Member

Neo-Oli commented Jun 15, 2018

@fornwall Well, it implements a lot of things that people have been asking for for a long time, so that's great.

David Kramer and others added 9 commits June 19, 2018 14:54
    * New Widgets: Date, Time, Spinner, Text-To-Speech, Confirmation
    * Results are returned as JSON including code of button pressed
    * Change DialogActivity to AppCompatActivity
    * Add support library dependency to gradle
    * Change theme to be compatible with AppCompatActivity
    * Refactor getSpinnerItems to getInputValues so BottomSheet can use
    as well
    * Prevent speech InputMethod from being cancelled on touch outside
    * Change FrameLayout to be NestedScrollView to handle scrolling
    large dialogs as necessary
@dkramer95 dkramer95 force-pushed the DialogEnhancements branch from 74248ec to ea61077 Compare June 20, 2018 04:13
@dkramer95
Copy link
Contributor Author

The accompanying termux/termux-api-package#18 is now finished!

@Grimler91
Copy link
Member

I can't get this to work, all dialogs show the default one, so for example with termux-dialog date -t "date plx":
screenshot_20180620-185838

The termux-api-package script seems to work alright, it at least passes the correct --es flag.

Here's the logcat "*:D" output from two tries:

--------- beginning of main
06-20 18:56:28.106  3661  3661 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10073 <<<<<<
06-20 18:56:28.109  3661  3661 W app_process: type=1400 audit(0.0:7239): avc: denied { write } for name="trace_marker" dev="debugfs" ino=334 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs:s0 tclass=file permissive=0
06-20 18:56:28.109  3661  3661 W app_process: type=1300 audit(0.0:7239): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=b542d04e a2=a0001 a3=0 items=1 ppid=3660 ppcomm=termux-api auid=4294967295 uid=10073 gid=10073 euid=10073 suid=10073 fsuid=10073 egid=10073 sgid=10073 fsgid=10073 tty=pts4 ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
06-20 18:56:28.114  3661  3661 D AndroidRuntime: CheckJNI is OFF
06-20 18:56:28.115  3661  3661 E cutils-trace: Error opening trace file: Permission denied (13)
06-20 18:56:28.981  3661  3661 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-20 18:56:29.065  3661  3661 I Radio-JNI: register_android_hardware_Radio DONE
06-20 18:56:29.084  3661  3661 D AndroidRuntime: Calling main entry com.example.termuxam.Am
06-20 18:56:29.159  3661  3661 D AndroidRuntime: Shutting down VM
06-20 18:56:29.250   484   505 D mali_winsys: new_window_surface returns 0x3000,  [1280x455]-format:1
06-20 18:56:29.301 17250 17250 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
06-20 18:56:29.301 17250 17250 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
06-20 18:56:30.826   484   484 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
06-20 18:56:30.826   484   484 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
06-20 18:56:30.880   484   505 D OpenGLRenderer: endAllActiveAnimators on 0xb2013300 (RippleDrawable) with handle 0x78fb99f0
06-20 18:56:31.416  3678  3678 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10073 <<<<<<
06-20 18:56:31.422  3678  3678 D AndroidRuntime: CheckJNI is OFF
06-20 18:56:31.419  3678  3678 W app_process: type=1400 audit(0.0:7240): avc: denied { write } for name="trace_marker" dev="debugfs" ino=334 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs:s0 tclass=file permissive=0
06-20 18:56:31.419  3678  3678 W app_process: type=1300 audit(0.0:7240): arch=40000028 syscall=322 per=800008 success=no exit=-13 a0=ffffff9c a1=b5afe04e a2=a0001 a3=0 items=1 ppid=3677 ppcomm=termux-api auid=4294967295 uid=10073 gid=10073 euid=10073 suid=10073 fsuid=10073 egid=10073 sgid=10073 fsgid=10073 tty=pts4 ses=4294967295 exe="/system/bin/app_process32" subj=u:r:untrusted_app:s0:c512,c768 key=(null)
06-20 18:56:31.423  3678  3678 E cutils-trace: Error opening trace file: Permission denied (13)
06-20 18:56:32.285  3678  3678 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-20 18:56:32.339  3678  3678 I Radio-JNI: register_android_hardware_Radio DONE
06-20 18:56:32.359  3678  3678 D AndroidRuntime: Calling main entry com.example.termuxam.Am
06-20 18:56:32.424  3678  3678 D AndroidRuntime: Shutting down VM
06-20 18:56:32.477   484   505 D mali_winsys: new_window_surface returns 0x3000,  [1288x545]-format:1
06-20 18:56:32.557 17250 17250 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
06-20 18:56:32.557 17250 17250 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
06-20 18:56:32.574   484   492 I art     : Do partial code cache collection, code=40KB, data=57KB
06-20 18:56:32.574   484   492 I art     : After code cache collection, code=40KB, data=57KB
06-20 18:56:32.574   484   492 I art     : Increasing code cache capacity to 256KB
06-20 18:56:32.579   484   492 I art     : Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
06-20 18:56:33.765   484   484 W IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection
06-20 18:56:33.765   484   484 W IInputConnectionWrapper: finishComposingText on inactive InputConnection
06-20 18:56:33.834   484   505 D OpenGLRenderer: endAllActiveAnimators on 0xb2017900 (RippleDrawable) with handle 0x6e2a8ba0

I've tried both on a arm android 7 tablet and a aarch64 android 8 phone.

@dkramer95
Copy link
Contributor Author

dkramer95 commented Jun 20, 2018

@Grimler91 Should be fixed now! (Issue was missing quotes in the calling script on the widget variable)

@Grimler91
Copy link
Member

Here's the (way more verbose) logcat "*:W" from android 8 :

06-20 19:27:23.616 23308 23308 D AndroidRuntime: Calling main entry com.example.termuxam.Am
06-20 19:27:23.653  3930  3980 I ActivityManager: START u0 {act=null typ=null flg=0x10000000 cmp=ComponentInfo{com.termux.api/com.termux.api.DialogActivity}} from uid 10232
06-20 19:27:23.667  3930  3980 D CustomFrequencyManagerService: acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 2314000  uid : 1000  pid : 3930  pkgName : AMS_APP_SWITCH@CPU_MIN@59
06-20 19:27:23.670  3930  3980 D ActivityManagerPerformance: AMP_acquire() APP_SWITCH
06-20 19:27:23.670  3930  5201 D ActivityManagerPerformance: Received MSG_CFMS_HINT_AMS_SWITCH pkgName: com.termux.api
06-20 19:27:23.671  3930  7187 D TelephonyManager: getAllCellInfo : Caller (PID / UID / TID): 3930 / 1000 / 7187
06-20 19:27:23.672  3930  3980 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.676  3930  5309 D ActivityManager: isScaleDownAnimationEnabled() : false
06-20 19:27:23.679  3930  5309 D PersonaManagerService: Current focused persona service handled id set to : 0
06-20 19:27:23.679  3930  5309 D InputDispatcher: Focused application set to: xxxx
06-20 19:27:23.679  3930  5309 D InputDispatcher: Focus left window: 11935
06-20 19:27:23.681  3930  4286 D GameManagerService: handleForegroundChange(). pkgName: com.termux.api, clsName: com.termux.api.DialogActivity,FgActivityName:com.termux.api/.DialogActivity
06-20 19:27:23.681  3930  4286 D GameManagerService: sem_perfomance_mode: 0
06-20 19:27:23.681  3930  5309 D MARsPolicyManager: onPackageResumedFG pkgName = com.termux.api, userId = 0
06-20 19:27:23.681  3930  4286 D GameManagerService: notifyResumePause(). pkg: com.termux.api, type: 4, isMinimized: false, isTunableApp: false
06-20 19:27:23.681  3930  4286 D GameManagerService:   notifyResumePause(). do nothing. mKillNotiCount: 3
06-20 19:27:23.685 11935 11935 D ViewRootImpl@79569d7[TermuxActivity]: MSG_WINDOW_FOCUS_CHANGED 0
06-20 19:27:23.686 23308 23308 D AndroidRuntime: Shutting down VM
06-20 19:27:23.686  3930  7187 D GamePkgDataHelper: getGamePkgDataIncServer(). com.termux.api
06-20 19:27:23.686  3930  7187 D GameManagerService: identifyGamePackage. com.termux.api
06-20 19:27:23.686  3930  7187 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.687  3930  7187 D GamePkgDataHelper: getSosPolicy(). com.termux.api
06-20 19:27:23.687  3930  7187 D GameManagerService: identifyGamePackage. com.termux.api
06-20 19:27:23.687  3930  7187 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.687  4671 11247 D ForegroundUtils: could not check pending caller
06-20 19:27:23.689  3930  7187 D GameManagerService: identifyGamePackage. com.termux.api
06-20 19:27:23.689  3930  7187 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.690  3930  7187 D GameManagerService: identifyGamePackage. com.termux.api
06-20 19:27:23.690  3930  7187 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.692  3930  7187 D GameManagerService: identifyGamePackage. com.termux.api
06-20 19:27:23.692  3930  7187 D GamePkgDataHelper: getGamePkgData(). com.termux.api
06-20 19:27:23.701 21776 21776 D ViewRootImpl@fd9627c[DialogActivity]: setView = DecorView@378e705[DialogActivity] TM=true MM=false
06-20 19:27:23.703  3930  5309 D ActivityManager: post active user change for 0 fullscreen false isHomeActivity() false
06-20 19:27:23.703 21776 21776 W Activity: AppLock checkAppLockState locked:false verifying:false pkgName = com.termux.api isInMultiWindowMode:false
06-20 19:27:23.715 21776 21776 D ViewRootImpl@fd9627c[DialogActivity]: dispatchAttachedToWindow
06-20 19:27:23.721  3509  3509 I SurfaceFlinger: id=1542 createSurf (1192x603),1 flag=4, com.termux.api/com.termux.api.DialogActivity#0
06-20 19:27:23.723  3930  4015 D WindowManager: set systemUiVisibility : systemUiFlags= 0x80008018 fullscreenStackSysUiFlags= 0x0
06-20 19:27:23.724  3930  3980 D InputDispatcher: Focus entered window: 21776
06-20 19:27:23.725  3930  5309 D WindowManager: adjustSystemUiVisibilityLw : vis= 0x80008018
06-20 19:27:23.725 21776 21776 D ViewRootImpl@fd9627c[DialogActivity]: Relayout returned: old=[0,0][0,0] new=[28,878][1052,1313] result=0x7 surface={valid=true 507134132224} changed=true
06-20 19:27:23.726 21776 21792 D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000,  [1192x603]-format:1
06-20 19:27:23.726 21776 21792 D OpenGLRenderer: eglCreateWindowSurface = 0x761e8cc6e0
06-20 19:27:23.727 21776 21776 D ViewRootImpl@fd9627c[DialogActivity]: MSG_RESIZED_REPORT: frame=Rect(28, 878 - 1052, 1313) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
06-20 19:27:23.727 21776 21776 D ViewRootImpl@fd9627c[DialogActivity]: MSG_WINDOW_FOCUS_CHANGED 1
06-20 19:27:23.731 21776 21776 I InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: startInputOrWindowGainedFocus : windowGainedFocus 
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: windowGainedFocus: destinationUserId (getCallingUid) = 0
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: windowGainedFocus: currentUserId=0
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: windowGainedFocus: mCurrentFocusedUserId=0
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: windowGainedFocus : lock - currentUserId = 0 destinationUserId = 0
06-20 19:27:23.731  3930  5309 D InputMethodManagerService: windowGainedFocus : mCurrentFocusedUserId - 0 and mSecureKeypadEnabled - false, userSwitched - false
06-20 19:27:23.733  3930  5309 D InputMethodManagerService: isImeSwitcherDisabledPackage : false
06-20 19:27:23.733  3930  5309 D InputMethodManagerService: shouldShowImeSwitcherLocked : checking vis : 3
06-20 19:27:23.734  3930  5309 D InputMethodManagerService: setCurrentInputInfo - inputContext : com.android.internal.view.IInputContext$Stub$Proxy@69a79e0 eidtorInfo : android.view.inputmethod.EditorInfo@4285499 missingMethods : 0
06-20 19:27:23.734  3930  3980 D InputMethodManagerService: isImeSwitcherDisabledPackage : false
06-20 19:27:23.735  4360  4360 I SKBD    : SamsungKeypad onFinishInputView
06-20 19:27:23.735  4381  4381 D SecNavigationBarView: setNavigationIconHints showImeButton : false
06-20 19:27:23.735  4381  4381 D SecNavigationBarView: updateImmersivePinIcon() isImmersiveMode=false
06-20 19:27:23.735  4360  4360 I SKBDC   : TymeCore iEC -502
06-20 19:27:23.736  4360  4360 I SKBD    : aha onFinishInput() took nanoTime:  67577
06-20 19:27:23.737  4360  4360 I SKBDC   : TymeCore cASl
06-20 19:27:23.737  4360  4360 I SKBDC   : ?? 50
06-20 19:27:23.740  4360  4360 E SKBD    : ayn getInstance start
06-20 19:27:23.740  4360  4360 E SKBD    : ayn sendSIPInformation state: 6   isAbstractKeyboardView :  true
06-20 19:27:23.740  3930  4800 W Binder  : Outgoing transactions from this process must be FLAG_ONEWAY
06-20 19:27:23.740  3930  4800 W Binder  : java.lang.Throwable
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.os.BinderProxy.transact(Binder.java:744)
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.app.assist.AssistStructure$ParcelTransferReader.fetchData(AssistStructure.java:407)
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.app.assist.AssistStructure$ParcelTransferReader.go(AssistStructure.java:343)
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.app.assist.AssistStructure.ensureData(AssistStructure.java:2100)
06-20 19:27:23.740  3930  4800 W Binder  : 	at com.android.server.autofill.Session$1.send(Unknown Source:95)
06-20 19:27:23.740  3930  4800 W Binder  : 	at com.android.server.am.ActivityManagerService.reportAssistContextExtras(Unknown Source:136)
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2559)
06-20 19:27:23.740  3930  4800 W Binder  : 	at com.android.server.am.ActivityManagerService.onTransact(Unknown Source:450)
06-20 19:27:23.740  3930  4800 W Binder  : 	at android.os.Binder.execTransact(Binder.java:682)
06-20 19:27:23.740 21776 21776 I AssistStructure: Flattened final assist data: 1488 bytes, containing 1 windows, 5 views
06-20 19:27:23.740  4360  4360 I SKBD_UnifiedIME: ToolBarManager setToolbarVisibility, visible = false
06-20 19:27:23.740  4360 23321 E SKBD    : ayn sending null keyboardInfo as SIP is closed
06-20 19:27:23.743  4360  4360 D InputMethodService: notifyKeyboardClosed
06-20 19:27:23.743 21811 21811 D [SPAF]AutofillService: onConnected
06-20 19:27:23.744  3930  4026 I ActivityManager: Displayed com.termux.api/.DialogActivity: +65ms
06-20 19:27:23.744  4360  4360 I SKBD    : akp SKBD InputEngineManagerImpl dismissHWR

@Grimler91
Copy link
Member

@dkramer95 great, so only update to termux-api-package?

@dkramer95
Copy link
Contributor Author

@Grimler91 Yes!

@Grimler91
Copy link
Member

@dkramer95 I still get the same behaviour :/

@Grimler91
Copy link
Member

Scratch that. I rebuild the app and it works as it should!

@Grimler91
Copy link
Member

The -p, -m, -i options for the text dialog aren't accepted, the termux-dialog script probably needs an update.

@dkramer95
Copy link
Contributor Author

dkramer95 commented Jun 20, 2018

@Grimler91 This is the correct behavior... the -i option requires a text argument (i will make that clearer in the help). -p and -m options can't be used at the same time but should work independently.

@dkramer95
Copy link
Contributor Author

@Grimler91 The termux-dialog script has been updated but only with documentation changes. I tried to make things a bit more clear. Have you ran into any other issues?

@Grimler91
Copy link
Member

@dkramer95 ah, I miss-understood the help message. termux/termux-api-package@08c9978 made it clearer.
Haven't noticed anything else, looks good to me 👍

    * change password type to a boolean option instead of string
    * allow multiline password (text only not numeric)
@dkramer95
Copy link
Contributor Author

@Grimler91 I was actually able to get multiline text password to work, i.e. -p and -m together. I also added a -n option for number input, but this won't work alongside the -m option. However -n will work -p.

@fornwall fornwall merged commit c4fbbf1 into termux:master Jun 21, 2018
@fornwall
Copy link
Member

@dkramer95 Awesome work! This will be in a v0.25 update which will be released in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants