android / camera-samples

Multiple samples showing the best practices in camera APIs on Android.
Apache License 2.0
5.01k stars 2.34k forks source link

Android 13: Fixed crash upon click on Launcher icon #499

Open ihrupin opened 2 years ago

ihrupin commented 2 years ago

The crash was caused because launcher activities android:exported attribute was false, but should be true. After that Launcher app is able to launch the app.

Device: Pixel 4a with Android 13

Please merge this PR.

Regards, Igor Khrupin

Stacktrace:

2022-07-28 19:17:33.408 23805-23805/? E/AppLauncher: Unable to launch. tag=AppInfo(id=-1 type=APP container=# com.android.launcher3.logger.LauncherAtom$ContainerInfo@1a1bf6a
    all_apps_container {
    } targetComponent=ComponentInfo{com.android.example.camera2.video/com.example.android.camera2.video.CameraActivity} screen=-1 cell(-1,-1) span(1,1) minSpan(1,1) rank=0 user=UserHandle{0} title=Camera2Video componentName=ComponentInfo{com.android.example.camera2.video/com.example.android.camera2.video.CameraActivity}) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.example.camera2.video/com.example.android.camera2.video.CameraActivity bnds=[540,1012][781,1326] }
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.example.camera2.video/com.example.android.camera2.video.CameraActivity bnds=[540,1012][781,1326] } from ProcessRecord{794bc32 23805:com.google.android.apps.nexuslauncher/u0a215} (pid=23805, uid=10215) not exported from uid 10276
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
        at android.os.Parcel.createException(Parcel.java:2995)
        at android.os.Parcel.readException(Parcel.java:2978)
        at android.os.Parcel.readException(Parcel.java:2920)
        at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2043)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1801)
        at android.app.Activity.startActivityForResult(Activity.java:5470)
        at com.android.launcher3.Launcher.startActivityForResult(Unknown Source:5)
        at com.android.launcher3.BaseQuickstepLauncher.startActivityForResult(Unknown Source:22)
        at android.app.Activity.startActivity(Activity.java:5922)
        at com.android.launcher3.views.AppLauncher.startActivitySafely(Unknown Source:121)
        at com.android.launcher3.Launcher.startActivitySafely(Unknown Source:26)
        at com.android.launcher3.uioverrides.QuickstepLauncher.startActivitySafely(Unknown Source:15)
        at com.android.launcher3.touch.ItemClickHandler.startAppShortcutOrInfoActivity(Unknown Source:124)
        at com.android.launcher3.touch.ItemClickHandler.onClick(Unknown Source:58)
        at com.android.launcher3.touch.ItemClickHandler.c(Unknown Source:0)
        at a1.d.onClick(Unknown Source:0)
        at android.view.View.performClick(View.java:7506)
        at android.view.View.performClickInternal(View.java:7483)
        at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
        at android.view.View$PerformClick.run(View.java:29335)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission(ActivityTaskSupervisor.java:1108)
        at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:1013)
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:702)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1240)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1203)
google-cla[bot] commented 2 years ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.