Loading packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,8 @@ <!-- Notification text displayed when we fail to take a screenshot. [CHAR LIMIT=100] --> <string name="screenshot_failed_to_capture_text">Taking screenshots isn\'t allowed by the app or your organization</string> <!-- Notification text displayed when screenshots are blocked by an IT admin. [CHAR LIMIT=100] --> <string name="screenshot_blocked_by_admin">Taking screenshots is blocked by your IT admin</string> <!-- Label for UI element which allows editing the screenshot [CHAR LIMIT=30] --> <string name="screenshot_edit_label">Edit</string> <!-- Content description indicating that tapping the element will allow editing the screenshot [CHAR LIMIT=NONE] --> Loading packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java +17 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static com.android.systemui.screenshot.LogConfig.logTag; import android.annotation.MainThread; import android.app.Service; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading @@ -42,9 +43,11 @@ import android.os.Looper; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.Log; import android.view.WindowManager; import android.widget.Toast; import androidx.annotation.NonNull; Loading @@ -62,9 +65,11 @@ public class TakeScreenshotService extends Service { private ScreenshotController mScreenshot; private final UserManager mUserManager; private final DevicePolicyManager mDevicePolicyManager; private final UiEventLogger mUiEventLogger; private final ScreenshotNotificationsController mNotificationsController; private final Handler mHandler; private final Context mContext; private final BroadcastReceiver mCloseSystemDialogs = new BroadcastReceiver() { @Override Loading @@ -91,16 +96,18 @@ public class TakeScreenshotService extends Service { @Inject public TakeScreenshotService(ScreenshotController screenshotController, UserManager userManager, UiEventLogger uiEventLogger, ScreenshotNotificationsController notificationsController) { DevicePolicyManager devicePolicyManager, UiEventLogger uiEventLogger, ScreenshotNotificationsController notificationsController, Context context) { if (DEBUG_SERVICE) { Log.d(TAG, "new " + this); } mHandler = new Handler(Looper.getMainLooper(), this::handleMessage); mScreenshot = screenshotController; mUserManager = userManager; mDevicePolicyManager = devicePolicyManager; mUiEventLogger = uiEventLogger; mNotificationsController = notificationsController; mContext = context; } @Override Loading Loading @@ -182,6 +189,14 @@ public class TakeScreenshotService extends Service { requestCallback.reportError(); return true; } if(mDevicePolicyManager.getScreenCaptureDisabled(null, UserHandle.USER_ALL)) { Log.w(TAG, "Skipping screenshot because an IT admin has disabled " + "screenshots on the device"); Toast.makeText(mContext, R.string.screenshot_blocked_by_admin, Toast.LENGTH_SHORT).show(); requestCallback.reportError(); return true; } ScreenshotHelper.ScreenshotRequest screenshotRequest = (ScreenshotHelper.ScreenshotRequest) msg.obj; Loading Loading
packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,8 @@ <!-- Notification text displayed when we fail to take a screenshot. [CHAR LIMIT=100] --> <string name="screenshot_failed_to_capture_text">Taking screenshots isn\'t allowed by the app or your organization</string> <!-- Notification text displayed when screenshots are blocked by an IT admin. [CHAR LIMIT=100] --> <string name="screenshot_blocked_by_admin">Taking screenshots is blocked by your IT admin</string> <!-- Label for UI element which allows editing the screenshot [CHAR LIMIT=30] --> <string name="screenshot_edit_label">Edit</string> <!-- Content description indicating that tapping the element will allow editing the screenshot [CHAR LIMIT=NONE] --> Loading
packages/SystemUI/src/com/android/systemui/screenshot/TakeScreenshotService.java +17 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static com.android.systemui.screenshot.LogConfig.logTag; import android.annotation.MainThread; import android.app.Service; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading @@ -42,9 +43,11 @@ import android.os.Looper; import android.os.Message; import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.os.UserManager; import android.util.Log; import android.view.WindowManager; import android.widget.Toast; import androidx.annotation.NonNull; Loading @@ -62,9 +65,11 @@ public class TakeScreenshotService extends Service { private ScreenshotController mScreenshot; private final UserManager mUserManager; private final DevicePolicyManager mDevicePolicyManager; private final UiEventLogger mUiEventLogger; private final ScreenshotNotificationsController mNotificationsController; private final Handler mHandler; private final Context mContext; private final BroadcastReceiver mCloseSystemDialogs = new BroadcastReceiver() { @Override Loading @@ -91,16 +96,18 @@ public class TakeScreenshotService extends Service { @Inject public TakeScreenshotService(ScreenshotController screenshotController, UserManager userManager, UiEventLogger uiEventLogger, ScreenshotNotificationsController notificationsController) { DevicePolicyManager devicePolicyManager, UiEventLogger uiEventLogger, ScreenshotNotificationsController notificationsController, Context context) { if (DEBUG_SERVICE) { Log.d(TAG, "new " + this); } mHandler = new Handler(Looper.getMainLooper(), this::handleMessage); mScreenshot = screenshotController; mUserManager = userManager; mDevicePolicyManager = devicePolicyManager; mUiEventLogger = uiEventLogger; mNotificationsController = notificationsController; mContext = context; } @Override Loading Loading @@ -182,6 +189,14 @@ public class TakeScreenshotService extends Service { requestCallback.reportError(); return true; } if(mDevicePolicyManager.getScreenCaptureDisabled(null, UserHandle.USER_ALL)) { Log.w(TAG, "Skipping screenshot because an IT admin has disabled " + "screenshots on the device"); Toast.makeText(mContext, R.string.screenshot_blocked_by_admin, Toast.LENGTH_SHORT).show(); requestCallback.reportError(); return true; } ScreenshotHelper.ScreenshotRequest screenshotRequest = (ScreenshotHelper.ScreenshotRequest) msg.obj; Loading