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

Commit e5bcff62 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Rename setApplicationBlocked to setApplicationHidden

This corrects the expected behavior of the app state. Hidden apps
can be installed by the store to be brought out of hidden state.

Bug: 16191518
Change-Id: Id128ce971ceee99ba1dea14ba07ce03bd8d77335
parent c2ae1a6b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5355,7 +5355,7 @@ package android.app.admin {
    method public boolean installCaCert(android.content.ComponentName, byte[]);
    method public boolean isActivePasswordSufficient();
    method public boolean isAdminActive(android.content.ComponentName);
    method public boolean isApplicationBlocked(android.content.ComponentName, java.lang.String);
    method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String);
    method public boolean isDeviceOwnerApp(java.lang.String);
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
@@ -5365,9 +5365,9 @@ package android.app.admin {
    method public boolean removeUser(android.content.ComponentName, android.os.UserHandle);
    method public boolean resetPassword(java.lang.String, int);
    method public void setAccountManagementDisabled(android.content.ComponentName, java.lang.String, boolean);
    method public boolean setApplicationBlocked(android.content.ComponentName, java.lang.String, boolean);
    method public boolean setApplicationHidden(android.content.ComponentName, java.lang.String, boolean);
    method public void setApplicationRestrictions(android.content.ComponentName, java.lang.String, android.os.Bundle);
    method public int setApplicationsBlocked(android.content.ComponentName, android.content.Intent, boolean);
    method public int setApplicationsHidden(android.content.ComponentName, android.content.Intent, boolean);
    method public void setBlockUninstall(android.content.ComponentName, java.lang.String, boolean);
    method public void setCameraDisabled(android.content.ComponentName, boolean);
    method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean);
+10 −10
Original line number Diff line number Diff line
@@ -197,13 +197,13 @@ public final class Pm {
            return;
        }

        if ("block".equals(op)) {
            runSetBlockedSetting(true);
        if ("hide".equals(op)) {
            runSetHiddenSetting(true);
            return;
        }

        if ("unblock".equals(op)) {
            runSetBlockedSetting(false);
        if ("unhide".equals(op)) {
            runSetHiddenSetting(false);
            return;
        }

@@ -1471,7 +1471,7 @@ public final class Pm {
        }
    }

    private void runSetBlockedSetting(boolean state) {
    private void runSetHiddenSetting(boolean state) {
        int userId = 0;
        String option = nextOption();
        if (option != null && option.equals("--user")) {
@@ -1492,9 +1492,9 @@ public final class Pm {
            return;
        }
        try {
            mPm.setApplicationBlockedSettingAsUser(pkg, state, userId);
            System.err.println("Package " + pkg + " new blocked state: "
                    + mPm.getApplicationBlockedSettingAsUser(pkg, userId));
            mPm.setApplicationHiddenSettingAsUser(pkg, state, userId);
            System.err.println("Package " + pkg + " new hidden state: "
                    + mPm.getApplicationHiddenSettingAsUser(pkg, userId));
        } catch (RemoteException e) {
            System.err.println(e.toString());
            System.err.println(PM_NOT_RUNNING_ERR);
@@ -1751,8 +1751,8 @@ public final class Pm {
        System.err.println("       pm disable [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm block [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm unblock [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm hide [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT");
        System.err.println("       pm grant PACKAGE PERMISSION");
        System.err.println("       pm revoke PACKAGE PERMISSION");
        System.err.println("       pm set-install-location [0/auto] [1/internal] [2/external]");
+4 −4
Original line number Diff line number Diff line
@@ -1452,10 +1452,10 @@ final class ApplicationPackageManager extends PackageManager {
    }

    @Override
    public boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked,
    public boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
            UserHandle user) {
        try {
            return mPM.setApplicationBlockedSettingAsUser(packageName, blocked,
            return mPM.setApplicationHiddenSettingAsUser(packageName, hidden,
                    user.getIdentifier());
        } catch (RemoteException re) {
            // Should never happen!
@@ -1464,9 +1464,9 @@ final class ApplicationPackageManager extends PackageManager {
    }

    @Override
    public boolean getApplicationBlockedSettingAsUser(String packageName, UserHandle user) {
    public boolean getApplicationHiddenSettingAsUser(String packageName, UserHandle user) {
        try {
            return mPM.getApplicationBlockedSettingAsUser(packageName, user.getIdentifier());
            return mPM.getApplicationHiddenSettingAsUser(packageName, user.getIdentifier());
        } catch (RemoteException re) {
            // Should never happen!
        }
+18 −18
Original line number Diff line number Diff line
@@ -2523,20 +2523,20 @@ public class DevicePolicyManager {
    }

    /**
     * Called by device or profile owner to block or unblock packages. When a package is blocked it
     * Called by device or profile owner to hide or unhide packages. When a package is hidden it
     * is unavailable for use, but the data and actual package file remain.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param packageName The name of the package to block or unblock.
     * @param blocked {@code true} if the package should be blocked, {@code false} if it should be
     *                 unblocked.
     * @return boolean Whether the blocked setting of the package was successfully updated.
     * @param packageName The name of the package to hide or unhide.
     * @param hidden {@code true} if the package should be hidden, {@code false} if it should be
     *                 unhidden.
     * @return boolean Whether the hidden setting of the package was successfully updated.
     */
    public boolean setApplicationBlocked(ComponentName admin, String packageName,
            boolean blocked) {
    public boolean setApplicationHidden(ComponentName admin, String packageName,
            boolean hidden) {
        if (mService != null) {
            try {
                return mService.setApplicationBlocked(admin, packageName, blocked);
                return mService.setApplicationHidden(admin, packageName, hidden);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
@@ -2545,20 +2545,20 @@ public class DevicePolicyManager {
    }

    /**
     * Called by profile or device owner to block or unblock currently installed packages. This
     * Called by profile or device owner to hide or unhide currently installed packages. This
     * should only be called by a profile or device owner running within a managed profile.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param intent An intent matching the app(s) to be updated. All apps that resolve for this
     *               intent will be updated in the current profile.
     * @param blocked {@code true} if the packages should be blocked, {@code false} if they should
     *                 be unblocked.
     * @param hidden {@code true} if the packages should be hidden, {@code false} if they should
     *                 be unhidden.
     * @return int The number of activities that matched the intent and were updated.
     */
    public int setApplicationsBlocked(ComponentName admin, Intent intent, boolean blocked) {
    public int setApplicationsHidden(ComponentName admin, Intent intent, boolean hidden) {
        if (mService != null) {
            try {
                return mService.setApplicationsBlocked(admin, intent, blocked);
                return mService.setApplicationsHidden(admin, intent, hidden);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
@@ -2567,16 +2567,16 @@ public class DevicePolicyManager {
    }

    /**
     * Called by device or profile owner to determine if a package is blocked.
     * Called by device or profile owner to determine if a package is hidden.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param packageName The name of the package to retrieve the blocked status of.
     * @return boolean {@code true} if the package is blocked, {@code false} otherwise.
     * @param packageName The name of the package to retrieve the hidden status of.
     * @return boolean {@code true} if the package is hidden, {@code false} otherwise.
     */
    public boolean isApplicationBlocked(ComponentName admin, String packageName) {
    public boolean isApplicationHidden(ComponentName admin, String packageName) {
        if (mService != null) {
            try {
                return mService.isApplicationBlocked(admin, packageName);
                return mService.isApplicationHidden(admin, packageName);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
+3 −3
Original line number Diff line number Diff line
@@ -132,9 +132,9 @@ interface IDevicePolicyManager {
    void addCrossProfileIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);
    void clearCrossProfileIntentFilters(in ComponentName admin);

    boolean setApplicationBlocked(in ComponentName admin, in String packageName, boolean blocked);
    int setApplicationsBlocked(in ComponentName admin, in Intent intent, boolean blocked);
    boolean isApplicationBlocked(in ComponentName admin, in String packageName);
    boolean setApplicationHidden(in ComponentName admin, in String packageName, boolean hidden);
    int setApplicationsHidden(in ComponentName admin, in Intent intent, boolean hidden);
    boolean isApplicationHidden(in ComponentName admin, in String packageName);

    UserHandle createUser(in ComponentName who, in String name);
    UserHandle createAndInitializeUser(in ComponentName who, in String name, in String profileOwnerName, in ComponentName profileOwnerComponent, in Bundle adminExtras);
Loading