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

Commit 87e03713 authored by Pierre-Laurent Coirier's avatar Pierre-Laurent Coirier
Browse files

[DO NOT MERGE] Grant fixed SMS & Phone permission to package handling the twinning

settings intent.

This change was never merged down from cw-e-dev to nyc-dev (there were a
merge conflict that was skipped to quickly unblock nyc-dev since this
change isn't needed for phone)

Original CL: ag/874613

The test part of this CL is already merged down to nyc (see ag/874315).

BUG: 27343350
Change-Id: I818424e94006910dc25bab7cccb24f7979c39c9e
parent 2cf3cc82
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -150,6 +150,9 @@ final class DefaultPermissionGrantPolicy {

    private static final int MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS = 1;

    private static final String ACTION_TWINNING =
            "com.google.android.clockwork.intent.TWINNING_SETTINGS";

    private final PackageManagerService mService;
    private final Handler mHandler;

@@ -603,8 +606,9 @@ final class DefaultPermissionGrantPolicy {
                grantRuntimePermissionsLPw(musicPackage, STORAGE_PERMISSIONS, userId);
            }

            // Android Wear Home
            // Android Wear
            if (mService.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) {
                // Android Wear Home
                Intent homeIntent = new Intent(Intent.ACTION_MAIN);
                homeIntent.addCategory(Intent.CATEGORY_HOME_MAIN);

@@ -621,6 +625,17 @@ final class DefaultPermissionGrantPolicy {
                    grantRuntimePermissionsLPw(wearHomePackage, LOCATION_PERMISSIONS, false,
                            userId);
                }

                // Android Wear Twinning
                Intent twinningIntent = new Intent(ACTION_TWINNING);
                PackageParser.Package twinningPackage = getDefaultSystemHandlerActivityPackageLPr(
                        twinningIntent, userId);

                if (twinningPackage != null
                        && doesPackageSupportRuntimePermissions(twinningPackage)) {
                    grantRuntimePermissionsLPw(twinningPackage, PHONE_PERMISSIONS, false, userId);
                    grantRuntimePermissionsLPw(twinningPackage, SMS_PERMISSIONS, false, userId);
                }
            }

            // Print Spooler