Loading core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4228,4 +4228,9 @@ <!-- The representation of a time duration when negative. An example is -1:14. This can be used with a countdown timer for example.--> <string name="negative_duration">\u2212<xliff:g id="time" example="1:14">%1$s</xliff:g></string> <!-- Title of notification shown when device has been forced to safe mode after a security compromise. --> <string name="audit_safemode_notification">Factory reset to use this device normally</string> <!-- Description of notification shown when device has been forced to safe mode after a security compromise. --> <string name="audit_safemode_notification_details">Touch to learn more.</string> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1895,6 +1895,8 @@ <java-symbol type="string" name="config_customVpnConfirmDialogComponent" /> <java-symbol type="string" name="config_defaultNetworkScorerPackageName" /> <java-symbol type="string" name="config_persistentDataPackageName" /> <java-symbol type="string" name="audit_safemode_notification" /> <java-symbol type="string" name="audit_safemode_notification_details" /> <java-symbol type="layout" name="resolver_list" /> <java-symbol type="id" name="resolver_list" /> Loading services/core/java/com/android/server/wm/WindowManagerService.java +34 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.app.ActivityManagerInternal; import android.app.ActivityManagerNative; import android.app.AppOpsManager; import android.app.IActivityManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; Loading Loading @@ -118,6 +121,7 @@ import android.view.animation.Animation; import android.view.inputmethod.InputMethodManagerInternal; import android.widget.Toast; import com.android.internal.R; import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.os.IResultReceiver; import com.android.internal.policy.IShortcutService; Loading Loading @@ -7468,6 +7472,35 @@ public class WindowManagerService extends IWindowManager.Stub return mCurrentFocus; } private void showAuditSafeModeNotification() { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_VIEW, Uri.parse("https://support.google.com/nexus/answer/2852139")), 0); String title = mContext.getString(R.string.audit_safemode_notification); Notification notification = new Notification.Builder(mContext) .setSmallIcon(com.android.internal.R.drawable.stat_sys_warning) .setWhen(0) .setOngoing(true) .setTicker(title) .setLocalOnly(true) .setPriority(Notification.PRIORITY_HIGH) .setVisibility(Notification.VISIBILITY_PUBLIC) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) .setContentTitle(title) .setContentText(mContext.getString(R.string.audit_safemode_notification_details)) .setContentIntent(pendingIntent) .build(); NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notifyAsUser(null, R.string.audit_safemode_notification, notification, UserHandle.ALL); } public boolean detectSafeMode() { if (!mInputMonitor.waitForInputDevicesReady( INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { Loading Loading @@ -7500,6 +7533,7 @@ public class WindowManagerService extends IWindowManager.Stub if (auditSafeMode >= buildDate) { mSafeMode = true; showAuditSafeModeNotification(); } else { SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, ""); SystemProperties.set(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, ""); Loading Loading
core/res/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4228,4 +4228,9 @@ <!-- The representation of a time duration when negative. An example is -1:14. This can be used with a countdown timer for example.--> <string name="negative_duration">\u2212<xliff:g id="time" example="1:14">%1$s</xliff:g></string> <!-- Title of notification shown when device has been forced to safe mode after a security compromise. --> <string name="audit_safemode_notification">Factory reset to use this device normally</string> <!-- Description of notification shown when device has been forced to safe mode after a security compromise. --> <string name="audit_safemode_notification_details">Touch to learn more.</string> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -1895,6 +1895,8 @@ <java-symbol type="string" name="config_customVpnConfirmDialogComponent" /> <java-symbol type="string" name="config_defaultNetworkScorerPackageName" /> <java-symbol type="string" name="config_persistentDataPackageName" /> <java-symbol type="string" name="audit_safemode_notification" /> <java-symbol type="string" name="audit_safemode_notification_details" /> <java-symbol type="layout" name="resolver_list" /> <java-symbol type="id" name="resolver_list" /> Loading
services/core/java/com/android/server/wm/WindowManagerService.java +34 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.app.ActivityManagerInternal; import android.app.ActivityManagerNative; import android.app.AppOpsManager; import android.app.IActivityManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; Loading Loading @@ -118,6 +121,7 @@ import android.view.animation.Animation; import android.view.inputmethod.InputMethodManagerInternal; import android.widget.Toast; import com.android.internal.R; import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.os.IResultReceiver; import com.android.internal.policy.IShortcutService; Loading Loading @@ -7468,6 +7472,35 @@ public class WindowManagerService extends IWindowManager.Stub return mCurrentFocus; } private void showAuditSafeModeNotification() { PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(Intent.ACTION_VIEW, Uri.parse("https://support.google.com/nexus/answer/2852139")), 0); String title = mContext.getString(R.string.audit_safemode_notification); Notification notification = new Notification.Builder(mContext) .setSmallIcon(com.android.internal.R.drawable.stat_sys_warning) .setWhen(0) .setOngoing(true) .setTicker(title) .setLocalOnly(true) .setPriority(Notification.PRIORITY_HIGH) .setVisibility(Notification.VISIBILITY_PUBLIC) .setColor(mContext.getColor( com.android.internal.R.color.system_notification_accent_color)) .setContentTitle(title) .setContentText(mContext.getString(R.string.audit_safemode_notification_details)) .setContentIntent(pendingIntent) .build(); NotificationManager notificationManager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notifyAsUser(null, R.string.audit_safemode_notification, notification, UserHandle.ALL); } public boolean detectSafeMode() { if (!mInputMonitor.waitForInputDevicesReady( INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { Loading Loading @@ -7500,6 +7533,7 @@ public class WindowManagerService extends IWindowManager.Stub if (auditSafeMode >= buildDate) { mSafeMode = true; showAuditSafeModeNotification(); } else { SystemProperties.set(ShutdownThread.REBOOT_SAFEMODE_PROPERTY, ""); SystemProperties.set(ShutdownThread.AUDIT_SAFEMODE_PROPERTY, ""); Loading