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

Commit f5d6516f authored by Sander Alewijnse's avatar Sander Alewijnse Committed by Android Git Automerger
Browse files

am fcb490a2: Merge "Add Device Policy API to disable screen capture." into lmp-dev

* commit 'fcb490a2d3b1f28a375e40b44201882ff171bfa5':
  Add Device Policy API to disable screen capture.
parents 6d5570ee 0c1dcfd1
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -5355,6 +5355,7 @@ package android.app.admin {
    method public int getPasswordMinimumSymbols(android.content.ComponentName);
    method public int getPasswordMinimumSymbols(android.content.ComponentName);
    method public int getPasswordMinimumUpperCase(android.content.ComponentName);
    method public int getPasswordMinimumUpperCase(android.content.ComponentName);
    method public int getPasswordQuality(android.content.ComponentName);
    method public int getPasswordQuality(android.content.ComponentName);
    method public boolean getScreenCaptureDisabled(android.content.ComponentName);
    method public boolean getStorageEncryption(android.content.ComponentName);
    method public boolean getStorageEncryption(android.content.ComponentName);
    method public int getStorageEncryptionStatus();
    method public int getStorageEncryptionStatus();
    method public boolean hasAnyCaCertsInstalled();
    method public boolean hasAnyCaCertsInstalled();
@@ -5399,6 +5400,7 @@ package android.app.admin {
    method public void setProfileName(android.content.ComponentName, java.lang.String);
    method public void setProfileName(android.content.ComponentName, java.lang.String);
    method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo);
    method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo);
    method public void setRestrictionsProvider(android.content.ComponentName, android.content.ComponentName);
    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 setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String);
    method public int setStorageEncryption(android.content.ComponentName, boolean);
    method public int setStorageEncryption(android.content.ComponentName, boolean);
    method public boolean switchUser(android.content.ComponentName, android.os.UserHandle);
    method public boolean switchUser(android.content.ComponentName, android.os.UserHandle);
+40 −0
Original line number Original line Diff line number Diff line
@@ -1774,6 +1774,46 @@ public class DevicePolicyManager {
        return false;
        return false;
    }
    }


    /**
     * Called by a device/profile owner to set whether the screen capture is disabled.
     *
     * <p>The calling device admin must be a device or profile owner. If it is not, a
     * security exception will be thrown.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     */
    public void setScreenCaptureDisabled(ComponentName admin, boolean disabled) {
        if (mService != null) {
            try {
                mService.setScreenCaptureDisabled(admin, UserHandle.myUserId(), disabled);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
        }
    }

    /**
     * Determine whether or not screen capture has been disabled by the current
     * admin, if specified, or all admins.
     * @param admin The name of the admin component to check, or null to check if any admins
     * have disabled screen capture.
     */
    public boolean getScreenCaptureDisabled(ComponentName admin) {
        return getScreenCaptureDisabled(admin, UserHandle.myUserId());
    }

    /** @hide per-user version */
    public boolean getScreenCaptureDisabled(ComponentName admin, int userHandle) {
        if (mService != null) {
            try {
                return mService.getScreenCaptureDisabled(admin, userHandle);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
        }
        return false;
    }

    /**
    /**
     * Called by an application that is administering the device to disable keyguard customizations,
     * Called by an application that is administering the device to disable keyguard customizations,
     * such as widgets. After setting this, keyguard features will be disabled according to the
     * such as widgets. After setting this, keyguard features will be disabled according to the
+3 −0
Original line number Original line Diff line number Diff line
@@ -88,6 +88,9 @@ interface IDevicePolicyManager {
    void setCameraDisabled(in ComponentName who, boolean disabled, int userHandle);
    void setCameraDisabled(in ComponentName who, boolean disabled, int userHandle);
    boolean getCameraDisabled(in ComponentName who, int userHandle);
    boolean getCameraDisabled(in ComponentName who, int userHandle);


    void setScreenCaptureDisabled(in ComponentName who, int userHandle, boolean disabled);
    boolean getScreenCaptureDisabled(in ComponentName who, int userHandle);

    void setKeyguardDisabledFeatures(in ComponentName who, int which, int userHandle);
    void setKeyguardDisabledFeatures(in ComponentName who, int which, int userHandle);
    int getKeyguardDisabledFeatures(in ComponentName who, int userHandle);
    int getKeyguardDisabledFeatures(in ComponentName who, int userHandle);


+6 −0
Original line number Original line Diff line number Diff line
@@ -149,6 +149,12 @@ interface IWindowManager
    // boolean string as parsed by SystemProperties.getBoolean().
    // boolean string as parsed by SystemProperties.getBoolean().
    void setStrictModeVisualIndicatorPreference(String enabled);
    void setStrictModeVisualIndicatorPreference(String enabled);


    /**
     * Update the windowmanagers cached value of
     * {@link android.app.admin.DevicePolicyManager#getScreenCaptureDisabled(null, userId)}
     */
    void updateScreenCaptureDisabled(int userId);

    // These can only be called with the SET_ORIENTATION permission.
    // These can only be called with the SET_ORIENTATION permission.
    /**
    /**
     * Update the current screen rotation based on the current state of
     * Update the current screen rotation based on the current state of
+1 −1
Original line number Original line Diff line number Diff line
@@ -191,7 +191,7 @@
    <!-- Notification title displayed when we fail to take a screenshot. [CHAR LIMIT=50] -->
    <!-- Notification title displayed when we fail to take a screenshot. [CHAR LIMIT=50] -->
    <string name="screenshot_failed_title">Couldn\'t capture screenshot.</string>
    <string name="screenshot_failed_title">Couldn\'t capture screenshot.</string>
    <!-- Notification text displayed when we fail to take a screenshot. [CHAR LIMIT=100] -->
    <!-- Notification text displayed when we fail to take a screenshot. [CHAR LIMIT=100] -->
    <string name="screenshot_failed_text">Couldn\'t save screenshot. Storage may be in use.</string>
    <string name="screenshot_failed_text">Can\'t take screenshot due to limited storage space, or it isn\'t allowed by the app or your organization.</string>


    <!-- Title for the USB function chooser in UsbPreferenceActivity. [CHAR LIMIT=30] -->
    <!-- Title for the USB function chooser in UsbPreferenceActivity. [CHAR LIMIT=30] -->
    <string name="usb_preference_title">USB file transfer options</string>
    <string name="usb_preference_title">USB file transfer options</string>
Loading