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

Commit 3fa3c28a authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Keep track of who has disabled applications.

Change-Id: I2640d3dc2200b589e2beb42a43cc93efd090f06e
parent b404ecc9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1218,7 +1218,8 @@ public final class Pm {
        ComponentName cn = ComponentName.unflattenFromString(pkg);
        if (cn == null) {
            try {
                mPm.setApplicationEnabledSetting(pkg, state, 0, userId);
                mPm.setApplicationEnabledSetting(pkg, state, 0, userId,
                        "shell:" + android.os.Process.myUid());
                System.err.println("Package " + pkg + " new state: "
                        + enabledSettingToString(
                        mPm.getApplicationEnabledSetting(pkg, userId)));
+2 −1
Original line number Diff line number Diff line
@@ -1279,7 +1279,8 @@ final class ApplicationPackageManager extends PackageManager {
    public void setApplicationEnabledSetting(String packageName,
                                             int newState, int flags) {
        try {
            mPM.setApplicationEnabledSetting(packageName, newState, flags, mContext.getUserId());
            mPM.setApplicationEnabledSetting(packageName, newState, flags,
                    mContext.getUserId(), mContext.getBasePackageName());
        } catch (RemoteException e) {
            // Should never happen!
        }
+2 −1
Original line number Diff line number Diff line
@@ -239,7 +239,8 @@ interface IPackageManager {
    /**
     * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
     */
    void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId);
    void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
            int userId, String callingPackage);
    
    /**
     * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ public class PackageUserState {
    public boolean installed;
    public int enabled;

    public String lastDisableAppCaller;

    public HashSet<String> disabledComponents;
    public HashSet<String> enabledComponents;

@@ -43,6 +45,7 @@ public class PackageUserState {
        stopped = o.stopped;
        notLaunched = o.notLaunched;
        enabled = o.enabled;
        lastDisableAppCaller = o.lastDisableAppCaller;
        disabledComponents = o.disabledComponents != null
                ? new HashSet<String>(o.disabledComponents) : null;
        enabledComponents = o.enabledComponents != null
+1 −1
Original line number Diff line number Diff line
@@ -2443,7 +2443,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) {
                ipm.setApplicationEnabledSetting(packageName,
                        PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
                        PackageManager.DONT_KILL_APP, userId);
                        PackageManager.DONT_KILL_APP, userId, "DevicePolicyManager");
            }
        } catch (RemoteException e) {
        }
Loading