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

Commit ea2ec97f authored by Benjamin Franz's avatar Benjamin Franz
Browse files

Introduce device owner API to disable the status bar

Let the device owner disable the status bar to achieve multi-app single purpose
mode. When the status bar is disabled, quick settings, notifications and the
assist gesture are blocked.

Bug: 19533026
Change-Id: I72830798135136e5edc53e5e2221aebb9a7c7d57
parent de77be63
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5737,6 +5737,7 @@ package android.app.admin {
    method public void setRestrictionsProvider(android.content.ComponentName, android.content.ComponentName);
    method public void setScreenCaptureDisabled(android.content.ComponentName, boolean);
    method public void setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public void setStatusBarEnabledState(android.content.ComponentName, boolean);
    method public int setStorageEncryption(android.content.ComponentName, boolean);
    method public void setTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle);
    method public void setUninstallBlocked(android.content.ComponentName, java.lang.String, boolean);
+1 −0
Original line number Diff line number Diff line
@@ -5841,6 +5841,7 @@ package android.app.admin {
    method public void setRestrictionsProvider(android.content.ComponentName, android.content.ComponentName);
    method public void setScreenCaptureDisabled(android.content.ComponentName, boolean);
    method public void setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public void setStatusBarEnabledState(android.content.ComponentName, boolean);
    method public int setStorageEncryption(android.content.ComponentName, boolean);
    method public void setTrustAgentConfiguration(android.content.ComponentName, android.content.ComponentName, android.os.PersistableBundle);
    method public void setUninstallBlocked(android.content.ComponentName, java.lang.String, boolean);
+16 −0
Original line number Diff line number Diff line
@@ -4210,4 +4210,20 @@ public class DevicePolicyManager {
            return false;
        }
    }

    /**
     * Called by device owner to set the enabled state of the status bar. Disabling the status
     * bar blocks notifications, quick settings and other screen overlays that allow escaping from
     * a single use device.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param enabled New state of the status bar.
     */
    public void setStatusBarEnabledState(ComponentName admin, boolean enabled) {
        try {
            mService.setStatusBarEnabledState(admin, enabled);
        } catch (RemoteException re) {
            Log.w(TAG, "Failed talking with device policy service", re);
        }
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -223,4 +223,5 @@ interface IDevicePolicyManager {
    PersistableBundle getOtaPolicy();

    boolean setKeyguardEnabledState(in ComponentName admin, boolean enabled);
    void setStatusBarEnabledState(in ComponentName who, boolean enabled);
}
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ interface IStatusBarService
    void expandNotificationsPanel();
    void collapsePanels();
    void disable(int what, IBinder token, String pkg);
    void disableForUser(int what, IBinder token, String pkg, int userId);
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
Loading