Fix system crash by debug parameters of activity launch
Since AMS and ATMS use different lock, setDebugFlagsForStartingActivity is posted to execute so it won't run on binder thread. And it may throw security exception if not debuggable, that causes crash on system server's thread (android.display). Except dealing with the exception, it is more efficient to check before calling setDebugFlagsForStartingActivity. And the check also avoids the case of setDebugApp that enforces permission which is always passed on non binder thread. 3 cases on a non-debuggable device (Build.IS_DEBUGGABLE is false): 1. adb shell am start -n com.android.settings/.Settings -S -D > Debugger dialog should not popup. 2. adb shell am start -n com.android.settings/.Settings -S \ --start-profiler /data/local/tmp/p > System should not crash. 3. Call IActivityTaskManager#startActivity by reflection to launch a non-debuggable app with debug flags. > System should not crash. Bug: 208266893 Bug: 192247102 Test: atest AmProfileTests AmStartOptionsTests Change-Id: I086635a50d8750580127f0b2868e5a241ac5f913
Loading
Please register or sign in to comment