Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db1f210a authored by Robin Lee's avatar Robin Lee
Browse files

Fix regression (infinite loop) in TV launch path

If we send ACTION_MANAGE_APP_PERMISSION and don't get a matching form
factor, we're going to reset the intent action and then just try to
launch the same thing again. This is not going to go well and can break
a device until the framework gives up and kills PermissionController.

The solution is to just add a TV case to the same place as the Auto one
that already exists here.

Test: atest android.permission3.cts
Test: atest android.permission2.cts
Test: atest android.permission.cts
Test: atest android.os.cts.AutoRevokeTest
Bug: 155356284
Change-Id: I1830737cdfd933060f800c44b9e599ae7c65d6a1
parent a7d1f5c5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.permissioncontroller.permission.ui.GrantPermissionsViewHandle
import com.android.permissioncontroller.permission.ui.LocationProviderInterceptDialog;
import com.android.permissioncontroller.permission.ui.ManagePermissionsActivity;
import com.android.permissioncontroller.permission.ui.auto.AutoAppPermissionFragment;
import com.android.permissioncontroller.permission.ui.television.AppPermissionFragment;
import com.android.permissioncontroller.permission.utils.LocationUtils;
import com.android.permissioncontroller.permission.utils.Utils;

@@ -150,6 +151,14 @@ public final class AppPermissionActivity extends FragmentActivity {

            getSupportFragmentManager().beginTransaction().replace(android.R.id.content,
                    androidXFragment).commit();
        } else if (DeviceUtils.isTelevision(this)) {
            Fragment androidXFragment = new AppPermissionFragment();
            androidXFragment.setArguments(
                    AppPermissionFragment.createArgs(
                            packageName, permissionName, groupName, userHandle, null, 0, null));
            getSupportFragmentManager().beginTransaction()
                    .replace(android.R.id.content, androidXFragment)
                    .commit();
        } else {
            startActivity(new Intent(getIntent()).setAction(ACTION_MANAGE_APP_PERMISSION));
            finish();