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

Commit 00075f92 authored by Nadav Bar's avatar Nadav Bar Committed by Android (Google) Code Review
Browse files

Merge "Add microphone pemrission on default to content catprue service package"

parents 66a23d05 6d79ab75
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -3016,6 +3016,15 @@ public class ApplicationPackageManager extends PackageManager {
        }
    }

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

    @Override
    public boolean isPackageStateProtected(String packageName, int userId) {
        try {
+2 −0
Original line number Diff line number Diff line
@@ -686,6 +686,8 @@ interface IPackageManager {

    String getWellbeingPackageName();

    String getContentCaptureServicePackageName();

    boolean isPackageStateProtected(String packageName, int userId);

    void sendDeviceCustomizationReadyBroadcast();
+10 −0
Original line number Diff line number Diff line
@@ -6733,6 +6733,16 @@ public abstract class PackageManager {
                "getWellbeingPackageName not implemented in subclass");
    }

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

    /**
     * @return whether a given package's state is protected, e.g. package cannot be disabled,
     *         suspended, hidden or force stopped.
+19 −2
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import static android.content.pm.PackageManager.FLAG_PERMISSION_REVOKE_ON_UPGRAD
import static android.content.pm.PackageManager.FLAG_PERMISSION_SYSTEM_FIXED;
import static android.content.pm.PackageManager.FLAG_PERMISSION_USER_FIXED;
import static android.content.pm.PackageManager.FLAG_PERMISSION_USER_SET;
import static android.content.pm.PackageManager.INSTALL_ALLOW_DOWNGRADE;
import static android.content.pm.PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
import static android.content.pm.PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
import static android.content.pm.PackageManager.INSTALL_FAILED_DUPLICATE_PERMISSION;
@@ -202,8 +201,8 @@ import android.content.pm.VersionedPackage;
import android.content.pm.dex.ArtManager;
import android.content.pm.dex.DexMetadataHelper;
import android.content.pm.dex.IArtManager;
import android.content.rollback.IRollbackManager;
import android.content.res.Resources;
import android.content.rollback.IRollbackManager;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.hardware.display.DisplayManager;
@@ -20095,6 +20094,24 @@ public class PackageManagerService extends IPackageManager.Stub
        return appPredictionServiceComponentName.getPackageName();
    }
    @Override
    public String getContentCaptureServicePackageName() {
        String contentCaptureServiceName =
                mContext.getString(R.string.config_defaultContentCaptureService);
        if (TextUtils.isEmpty(contentCaptureServiceName)) {
            return null;
        }
        int separatorIndex = contentCaptureServiceName.indexOf("/");
        if (separatorIndex < 0) {
            return null;
        }
        return contentCaptureServiceName.substring(0, separatorIndex);
    }
    @Override
    public void setApplicationEnabledSetting(String appPackageName,
            int newState, int flags, int userId, String callingPackage) {
+8 −0
Original line number Diff line number Diff line
@@ -737,6 +737,14 @@ public final class DefaultPermissionGrantPolicy {
        grantSystemFixedPermissionsToSystemPackage("com.android.sharedstoragebackup", userId,
                STORAGE_PERMISSIONS);

        // Content Capture Service
        String contentCaptureServicePackageName =
                mContext.getPackageManager().getContentCaptureServicePackageName();
        if (!TextUtils.isEmpty(contentCaptureServicePackageName)) {
            grantPermissionsToSystemPackage(contentCaptureServicePackageName, userId,
                    MICROPHONE_PERMISSIONS);
        }

        if (mPermissionGrantedCallback != null) {
            mPermissionGrantedCallback.onDefaultRuntimePermissionsGranted(userId);
        }
Loading