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

Commit 8915b35f authored by Yi Jiang's avatar Yi Jiang Committed by Alex Salo
Browse files

Grants camera permission to Attention Service.

Bug: 128641304
Test: manually ran DefaultPermissionGrantPolicyTest
Change-Id: I63a1d7b9fdba02b813dfb0d4ef3ccfe4aa4857d1
parent 1f9256fa
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -3048,6 +3048,15 @@ public class ApplicationPackageManager extends PackageManager {
        }
        }
    }
    }


    @Override
    public String getAttentionServicePackageName() {
        try {
            return mPM.getAttentionServicePackageName();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    @Override
    @Override
    public String getWellbeingPackageName() {
    public String getWellbeingPackageName() {
        try {
        try {
+2 −0
Original line number Original line Diff line number Diff line
@@ -740,6 +740,8 @@ interface IPackageManager {


    String getSystemTextClassifierPackageName();
    String getSystemTextClassifierPackageName();


    String getAttentionServicePackageName();

    String getWellbeingPackageName();
    String getWellbeingPackageName();


    String getAppPredictionServicePackageName();
    String getAppPredictionServicePackageName();
+10 −0
Original line number Original line Diff line number Diff line
@@ -6877,6 +6877,16 @@ public abstract class PackageManager {
                "getSystemTextClassifierPackageName not implemented in subclass");
                "getSystemTextClassifierPackageName not implemented in subclass");
    }
    }


    /**
     * @return  attention service package name, or null if there's none.
     *
     * @hide
     */
    public String getAttentionServicePackageName() {
        throw new UnsupportedOperationException(
                "getAttentionServicePackageName not implemented in subclass");
    }

    /**
    /**
     * @return the wellbeing app package name, or null if it's not defined by the OEM.
     * @return the wellbeing app package name, or null if it's not defined by the OEM.
     *
     *
+5 −0
Original line number Original line Diff line number Diff line
@@ -20207,6 +20207,11 @@ public class PackageManagerService extends IPackageManager.Stub
        return mContext.getString(R.string.config_defaultTextClassifierPackage);
        return mContext.getString(R.string.config_defaultTextClassifierPackage);
    }
    }
    @Override
    public String getAttentionServicePackageName() {
        return mContext.getString(R.string.config_defaultAttentionService);
    }
    private @Nullable String getDocumenterPackageName() {
    private @Nullable String getDocumenterPackageName() {
        final Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        final Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
+8 −0
Original line number Original line Diff line number Diff line
@@ -743,6 +743,14 @@ public final class DefaultPermissionGrantPolicy {
                    LOCATION_PERMISSIONS, CONTACTS_PERMISSIONS);
                    LOCATION_PERMISSIONS, CONTACTS_PERMISSIONS);
        }
        }


        // Atthention Service
        String attentionServicePackageName =
                mContext.getPackageManager().getAttentionServicePackageName();
        if (!TextUtils.isEmpty(attentionServicePackageName)) {
            grantPermissionsToSystemPackage(attentionServicePackageName, userId,
                    CAMERA_PERMISSIONS);
        }

        // There is no real "marker" interface to identify the shared storage backup, it is
        // There is no real "marker" interface to identify the shared storage backup, it is
        // hardcoded in BackupManagerService.SHARED_BACKUP_AGENT_PACKAGE.
        // hardcoded in BackupManagerService.SHARED_BACKUP_AGENT_PACKAGE.
        grantSystemFixedPermissionsToSystemPackage("com.android.sharedstoragebackup", userId,
        grantSystemFixedPermissionsToSystemPackage("com.android.sharedstoragebackup", userId,
Loading