Merge "standardize system notification IDs" into oc-dev
This commit is contained in:
@@ -24,6 +24,9 @@ message SystemMessage {
|
||||
|
||||
// System message IDs
|
||||
// These are non-consecutive in order to preserve some existing, ad hoc IDs.
|
||||
// It is OK to use skipped IDs.
|
||||
// Prefer to add new IDs consecutively from zero, search for ADD_NEW_IDS_ABOVE_THIS_LINE.
|
||||
// Most of these IDs only became meaningful with the O release.
|
||||
enum ID {
|
||||
// Unknown
|
||||
NOTE_UNKNOWN = 0;
|
||||
@@ -56,6 +59,112 @@ message SystemMessage {
|
||||
// Package: com.android.systemui
|
||||
NOTE_INSTANT_APPS = 7;
|
||||
|
||||
// Notify the user that they should select an input method
|
||||
// Package: android
|
||||
NOTE_SELECT_INPUT_METHOD = 8;
|
||||
|
||||
// Notify the user about limited functionality before decryption
|
||||
// Package: android
|
||||
NOTE_FBE_ENCRYPTED_NOTIFICATION = 9;
|
||||
|
||||
// Give the user a way out of car mode
|
||||
// Package: android
|
||||
NOTE_CAR_MODE_DISABLE = 10;
|
||||
|
||||
// Notification to tell the user that a heavy-weight application is running.
|
||||
// Package: android
|
||||
NOTE_HEAVY_WEIGHT_NOTIFICATION = 11;
|
||||
|
||||
// Notification to tell the user that a process has exceeded its memory limit.
|
||||
// Package: android
|
||||
NOTE_DUMP_HEAP_NOTIFICATION = 12;
|
||||
|
||||
// Notification that is shown when finishing a system upgrade
|
||||
// Package: android
|
||||
NOTE_SYSTEM_UPGRADING = 13;
|
||||
|
||||
// Notify the user that tethering is active.
|
||||
// Package: android
|
||||
NOTE_TETHER_GENERAL = 14;
|
||||
NOTE_TETHER_USB = 15;
|
||||
NOTE_TETHER_BLUETOOTH = 16;
|
||||
|
||||
// Notify the user that always-on VPN has disconnected.
|
||||
// Package: android
|
||||
NOTE_VPN_DISCONNECTED = 17;
|
||||
|
||||
// Notify the user about a sync error.
|
||||
// Package: android
|
||||
NOTE_SYNC_ERROR = 18;
|
||||
|
||||
// Ask the user to select a keyboard language and layout
|
||||
// Package: android
|
||||
NOTE_SELECT_KEYBOARD_LAYOUT = 19;
|
||||
|
||||
// Update the user about the status of the VPN
|
||||
// Package: android
|
||||
NOTE_VPN_STATUS = 20;
|
||||
|
||||
// Package manager either installed or deleted a package
|
||||
// Package: android
|
||||
NOTE_PACKAGE_STATE = 21;
|
||||
|
||||
// Tell the user that storage space is low
|
||||
// Package: android
|
||||
NOTE_LOW_STORAGE = 23;
|
||||
|
||||
// Confirm that the user wants to reset out of retail demo mode
|
||||
// Package: android
|
||||
NOTE_RETAIL_RESET = 24;
|
||||
|
||||
// Entice the use to tap to share files
|
||||
// Package: android
|
||||
NOTE_USB_MTP_TAP = 25;
|
||||
|
||||
// Display the Android Debug Protocol status
|
||||
// Package: android
|
||||
NOTE_ADB_ACTIVE = 26;
|
||||
|
||||
// Inform that USB is configured for Media Transfer Protocol
|
||||
// Package: android
|
||||
NOTE_USB_MTP = 27;
|
||||
|
||||
// Inform that USB is configured for Picture Transfer Protocol
|
||||
// Package: android
|
||||
NOTE_USB_PTP = 28;
|
||||
|
||||
// Inform that USB is configured as a Musical Instrument Digital Interface
|
||||
// Package: android
|
||||
NOTE_USB_MIDI = 29;
|
||||
|
||||
// Inform that USB is configured in host mode
|
||||
// Package: android
|
||||
NOTE_USB_ACCESSORY = 30;
|
||||
|
||||
// Inform the user that the device is supplying power to another device.
|
||||
// Package: android
|
||||
NOTE_USB_SUPPLYING = 31;
|
||||
|
||||
// Inform the user that the device is consuming power from another device.
|
||||
// Package: android
|
||||
NOTE_USB_CHARGING = 32;
|
||||
|
||||
// Inform the user that a certificate authority is managing SSL
|
||||
// Package: android
|
||||
NOTE_SSL_CERT_INFO = 33;
|
||||
|
||||
// ADD_NEW_IDS_ABOVE_THIS_LINE
|
||||
// Legacy IDs with arbitrary values appear below
|
||||
// Legacy IDs existed as stable non-conflicting constants prior to the O release
|
||||
|
||||
// Notify the user that their work profile has been deleted
|
||||
// Package: android
|
||||
NOTE_PROFILE_WIPED = 1001;
|
||||
|
||||
// Warn the user that their org can monitor the network
|
||||
// Package: android
|
||||
NOTE_NETWORK_LOGGING = 1002;
|
||||
|
||||
// Confirm that the user wants to remove the guest account.
|
||||
// Package: com.android.systemui
|
||||
NOTE_REMOVE_GUEST = 1010;
|
||||
@@ -64,9 +173,13 @@ message SystemMessage {
|
||||
// Package: com.android.systemui
|
||||
NOTE_LOGOUT_USER = 1011;
|
||||
|
||||
// Communicate to the user about remote bugreports.
|
||||
// Package: android
|
||||
NOTE_REMOTE_BUGREPORT = 678432343;
|
||||
|
||||
// Notify the user about public volume state changes..
|
||||
// Package: com.android.systemui
|
||||
NOTE_STORAGE_PUBLIC = 0x53505542;
|
||||
NOTE_STORAGE_PUBLIC = 0x53505542; // 1397773634
|
||||
|
||||
// Notify the user about private volume state changes.
|
||||
// Package: com.android.systemui
|
||||
@@ -79,5 +192,9 @@ message SystemMessage {
|
||||
// Notify the user that data or apps are being moved to external storage.
|
||||
// Package: com.android.systemui
|
||||
NOTE_STORAGE_MOVE = 0x534d4f56;
|
||||
|
||||
// Account Manager allocates IDs sequentially, starting here.
|
||||
// Package: android
|
||||
ACCOUNT_MANAGER_BASE = 0x70000000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController;
|
||||
import com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem;
|
||||
import com.android.internal.inputmethod.InputMethodUtils;
|
||||
import com.android.internal.inputmethod.InputMethodUtils.InputMethodSettings;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.HandlerCaller;
|
||||
import com.android.internal.os.SomeArgs;
|
||||
@@ -2192,7 +2193,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
Slog.d(TAG, "--- show notification: label = " + summary);
|
||||
}
|
||||
mNotificationManager.notifyAsUser(null,
|
||||
com.android.internal.R.string.select_input_method,
|
||||
SystemMessage.NOTE_SELECT_INPUT_METHOD,
|
||||
mImeSwitcherNotification.build(), UserHandle.ALL);
|
||||
mNotificationShown = true;
|
||||
}
|
||||
@@ -2204,7 +2205,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
Slog.d(TAG, "--- hide notification");
|
||||
}
|
||||
mNotificationManager.cancelAsUser(null,
|
||||
com.android.internal.R.string.select_input_method, UserHandle.ALL);
|
||||
SystemMessage.NOTE_SELECT_INPUT_METHOD, UserHandle.ALL);
|
||||
mNotificationShown = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ import android.util.Log;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.widget.ICheckCredentialProgressCallback;
|
||||
@@ -127,7 +128,6 @@ import javax.crypto.spec.GCMParameterSpec;
|
||||
public class LockSettingsService extends ILockSettings.Stub {
|
||||
private static final String TAG = "LockSettingsService";
|
||||
private static final String PERMISSION = ACCESS_KEYGUARD_SECURE_STORAGE;
|
||||
private static final int FBE_ENCRYPTED_NOTIFICATION = 0;
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final int PROFILE_KEY_IV_SIZE = 12;
|
||||
@@ -461,12 +461,14 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
||||
.setContentIntent(intent)
|
||||
.build();
|
||||
mNotificationManager.notifyAsUser(null, FBE_ENCRYPTED_NOTIFICATION, notification, user);
|
||||
mNotificationManager.notifyAsUser(null, SystemMessage.NOTE_FBE_ENCRYPTED_NOTIFICATION,
|
||||
notification, user);
|
||||
}
|
||||
|
||||
private void hideEncryptionNotification(UserHandle userHandle) {
|
||||
if (DEBUG) Slog.v(TAG, "hide encryption notification, user: " + userHandle.getIdentifier());
|
||||
mNotificationManager.cancelAsUser(null, FBE_ENCRYPTED_NOTIFICATION, userHandle);
|
||||
mNotificationManager.cancelAsUser(null, SystemMessage.NOTE_FBE_ENCRYPTED_NOTIFICATION,
|
||||
userHandle);
|
||||
}
|
||||
|
||||
public void onCleanupUser(int userId) {
|
||||
|
||||
@@ -58,6 +58,7 @@ import java.util.Collections;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.app.DisableCarModeActivity;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.server.power.ShutdownThread;
|
||||
import com.android.server.twilight.TwilightListener;
|
||||
@@ -710,10 +711,10 @@ final class UiModeManagerService extends SystemService {
|
||||
PendingIntent.getActivityAsUser(context, 0, carModeOffIntent, 0,
|
||||
null, UserHandle.CURRENT));
|
||||
mNotificationManager.notifyAsUser(null,
|
||||
R.string.car_mode_disable_notification_title, n.build(), UserHandle.ALL);
|
||||
SystemMessage.NOTE_CAR_MODE_DISABLE, n.build(), UserHandle.ALL);
|
||||
} else {
|
||||
mNotificationManager.cancelAsUser(null,
|
||||
R.string.car_mode_disable_notification_title, UserHandle.ALL);
|
||||
SystemMessage.NOTE_CAR_MODE_DISABLE, UserHandle.ALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ import com.android.internal.R;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.content.PackageMonitor;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
@@ -189,7 +190,8 @@ public class AccountManagerService
|
||||
}
|
||||
|
||||
private final LinkedHashMap<String, Session> mSessions = new LinkedHashMap<String, Session>();
|
||||
private final AtomicInteger mNotificationIds = new AtomicInteger(1);
|
||||
private final AtomicInteger mNotificationIds =
|
||||
new AtomicInteger(SystemMessage.ACCOUNT_MANAGER_BASE);
|
||||
|
||||
static class UserAccounts {
|
||||
private final int userId;
|
||||
|
||||
@@ -339,6 +339,7 @@ import com.android.internal.app.SystemUserHomeActivity;
|
||||
import com.android.internal.app.procstats.ProcessStats;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.os.BatteryStatsImpl;
|
||||
import com.android.internal.os.IResultReceiver;
|
||||
@@ -2121,7 +2122,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
try {
|
||||
int[] outId = new int[1];
|
||||
inm.enqueueNotificationWithTag("android", "android", null,
|
||||
R.string.heavy_weight_notification,
|
||||
SystemMessage.NOTE_HEAVY_WEIGHT_NOTIFICATION,
|
||||
notification, outId, root.userId);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(ActivityManagerService.TAG,
|
||||
@@ -2139,7 +2140,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
try {
|
||||
inm.cancelNotificationWithTag("android", null,
|
||||
R.string.heavy_weight_notification, msg.arg1);
|
||||
SystemMessage.NOTE_HEAVY_WEIGHT_NOTIFICATION, msg.arg1);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(ActivityManagerService.TAG,
|
||||
"Error canceling notification for service", e);
|
||||
@@ -2376,7 +2377,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
try {
|
||||
int[] outId = new int[1];
|
||||
inm.enqueueNotificationWithTag("android", "android", null,
|
||||
R.string.dump_heap_notification,
|
||||
SystemMessage.NOTE_DUMP_HEAP_NOTIFICATION,
|
||||
notification, outId, userId);
|
||||
} catch (RuntimeException e) {
|
||||
Slog.w(ActivityManagerService.TAG,
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.os.UserHandle;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.util.ProgressReporter;
|
||||
import com.android.server.UiThread;
|
||||
@@ -159,11 +160,13 @@ public abstract class PreBootBroadcaster extends IIntentReceiver.Stub {
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
||||
.setProgress(max, index, false)
|
||||
.build();
|
||||
notifManager.notifyAsUser(TAG, 0, notif, UserHandle.of(mUserId));
|
||||
notifManager.notifyAsUser(TAG, SystemMessage.NOTE_SYSTEM_UPGRADING, notif,
|
||||
UserHandle.of(mUserId));
|
||||
break;
|
||||
|
||||
case MSG_HIDE:
|
||||
notifManager.cancelAsUser(TAG, 0, UserHandle.of(mUserId));
|
||||
notifManager.cancelAsUser(TAG, SystemMessage.NOTE_SYSTEM_UPGRADING,
|
||||
UserHandle.of(mUserId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.telephony.IccCardConstants;
|
||||
import com.android.internal.telephony.TelephonyIntents;
|
||||
@@ -618,30 +619,43 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
||||
|
||||
if (usbTethered) {
|
||||
if (wifiTethered || bluetoothTethered) {
|
||||
showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_general);
|
||||
showTetheredNotification(SystemMessage.NOTE_TETHER_GENERAL);
|
||||
} else {
|
||||
showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_usb);
|
||||
showTetheredNotification(SystemMessage.NOTE_TETHER_USB);
|
||||
}
|
||||
} else if (wifiTethered) {
|
||||
if (bluetoothTethered) {
|
||||
showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_general);
|
||||
showTetheredNotification(SystemMessage.NOTE_TETHER_GENERAL);
|
||||
} else {
|
||||
/* We now have a status bar icon for WifiTethering, so drop the notification */
|
||||
clearTetheredNotification();
|
||||
}
|
||||
} else if (bluetoothTethered) {
|
||||
showTetheredNotification(com.android.internal.R.drawable.stat_sys_tether_bluetooth);
|
||||
showTetheredNotification(SystemMessage.NOTE_TETHER_BLUETOOTH);
|
||||
} else {
|
||||
clearTetheredNotification();
|
||||
}
|
||||
}
|
||||
|
||||
private void showTetheredNotification(int icon) {
|
||||
private void showTetheredNotification(int id) {
|
||||
NotificationManager notificationManager =
|
||||
(NotificationManager)mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
if (notificationManager == null) {
|
||||
return;
|
||||
}
|
||||
int icon = 0;
|
||||
switch(id) {
|
||||
case SystemMessage.NOTE_TETHER_USB:
|
||||
icon = com.android.internal.R.drawable.stat_sys_tether_usb;
|
||||
break;
|
||||
case SystemMessage.NOTE_TETHER_BLUETOOTH:
|
||||
icon = com.android.internal.R.drawable.stat_sys_tether_bluetooth;
|
||||
break;
|
||||
case SystemMessage.NOTE_TETHER_GENERAL:
|
||||
default:
|
||||
icon = com.android.internal.R.drawable.stat_sys_tether_general;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mLastNotificationId != 0) {
|
||||
if (mLastNotificationId == icon) {
|
||||
@@ -678,7 +692,7 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
||||
.setContentTitle(title)
|
||||
.setContentText(message)
|
||||
.setContentIntent(pi);
|
||||
mLastNotificationId = icon;
|
||||
mLastNotificationId = id;
|
||||
|
||||
notificationManager.notifyAsUser(null, mLastNotificationId,
|
||||
mTetheredNotificationBuilder.build(), UserHandle.ALL);
|
||||
|
||||
@@ -81,6 +81,7 @@ import android.util.Log;
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.net.LegacyVpnInfo;
|
||||
import com.android.internal.net.VpnConfig;
|
||||
import com.android.internal.net.VpnInfo;
|
||||
@@ -1304,7 +1305,8 @@ public class Vpn {
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
||||
.setOngoing(true)
|
||||
.setColor(mContext.getColor(R.color.system_notification_accent_color));
|
||||
notificationManager.notifyAsUser(TAG, 0, builder.build(), user);
|
||||
notificationManager.notifyAsUser(TAG, SystemMessage.NOTE_VPN_DISCONNECTED,
|
||||
builder.build(), user);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.server.LocalServices;
|
||||
@@ -3169,8 +3170,9 @@ public class SyncManager {
|
||||
info.provider, syncResult.stats.numDeletes,
|
||||
info.userId);
|
||||
} else {
|
||||
mNotificationMgr.cancelAsUser(null,
|
||||
info.account.hashCode() ^ info.provider.hashCode(),
|
||||
mNotificationMgr.cancelAsUser(
|
||||
Integer.toString(info.account.hashCode() ^ info.provider.hashCode()),
|
||||
SystemMessage.NOTE_SYNC_ERROR,
|
||||
new UserHandle(info.userId));
|
||||
}
|
||||
if (syncResult != null && syncResult.fullSyncRequested) {
|
||||
@@ -3270,7 +3272,9 @@ public class SyncManager {
|
||||
.setContentIntent(pendingIntent)
|
||||
.build();
|
||||
notification.flags |= Notification.FLAG_ONGOING_EVENT;
|
||||
mNotificationMgr.notifyAsUser(null, account.hashCode() ^ authority.hashCode(),
|
||||
mNotificationMgr.notifyAsUser(
|
||||
Integer.toString(account.hashCode() ^ authority.hashCode()),
|
||||
SystemMessage.NOTE_SYNC_ERROR,
|
||||
notification, user);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.os.ShellCallback;
|
||||
import android.util.Log;
|
||||
import android.view.Display;
|
||||
import com.android.internal.inputmethod.InputMethodSubtypeHandle;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.SomeArgs;
|
||||
import com.android.internal.R;
|
||||
@@ -986,7 +987,7 @@ public class InputManagerService extends IInputManager.Stub
|
||||
com.android.internal.R.color.system_notification_accent_color))
|
||||
.build();
|
||||
mNotificationManager.notifyAsUser(null,
|
||||
R.string.select_keyboard_layout_notification_title,
|
||||
SystemMessage.NOTE_SELECT_KEYBOARD_LAYOUT,
|
||||
notification, UserHandle.ALL);
|
||||
mKeyboardLayoutNotificationShown = true;
|
||||
}
|
||||
@@ -997,7 +998,7 @@ public class InputManagerService extends IInputManager.Stub
|
||||
if (mKeyboardLayoutNotificationShown) {
|
||||
mKeyboardLayoutNotificationShown = false;
|
||||
mNotificationManager.cancelAsUser(null,
|
||||
R.string.select_keyboard_layout_notification_title,
|
||||
SystemMessage.NOTE_SELECT_KEYBOARD_LAYOUT,
|
||||
UserHandle.ALL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.net.VpnConfig;
|
||||
import com.android.internal.net.VpnProfile;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
@@ -344,10 +345,11 @@ public class LockdownVpnTracker {
|
||||
.setColor(mContext.getColor(
|
||||
com.android.internal.R.color.system_notification_accent_color));
|
||||
|
||||
NotificationManager.from(mContext).notify(TAG, 0, builder.build());
|
||||
NotificationManager.from(mContext).notify(null, SystemMessage.NOTE_VPN_STATUS,
|
||||
builder.build());
|
||||
}
|
||||
|
||||
private void hideNotification() {
|
||||
NotificationManager.from(mContext).cancel(TAG, 0);
|
||||
NotificationManager.from(mContext).cancel(null, SystemMessage.NOTE_VPN_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ import libcore.io.IoUtils;
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.content.PackageHelper;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.util.FastXmlSerializer;
|
||||
import com.android.internal.util.ImageUtils;
|
||||
@@ -995,7 +996,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
|
||||
if (PackageManager.DELETE_SUCCEEDED == returnCode && mNotification != null) {
|
||||
NotificationManager notificationManager = (NotificationManager)
|
||||
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(basePackageName, 0, mNotification);
|
||||
notificationManager.notify(basePackageName,
|
||||
SystemMessage.NOTE_PACKAGE_STATE,
|
||||
mNotification);
|
||||
}
|
||||
final Intent fillIn = new Intent();
|
||||
fillIn.putExtra(PackageInstaller.EXTRA_PACKAGE_NAME, mPackageName);
|
||||
@@ -1054,7 +1057,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
|
||||
if (notification != null) {
|
||||
NotificationManager notificationManager = (NotificationManager)
|
||||
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.notify(basePackageName, 0, notification);
|
||||
notificationManager.notify(basePackageName,
|
||||
SystemMessage.NOTE_PACKAGE_STATE,
|
||||
notification);
|
||||
}
|
||||
}
|
||||
final Intent fillIn = new Intent();
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.android.server.storage;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.server.EventLogTags;
|
||||
import com.android.server.SystemService;
|
||||
@@ -93,7 +95,6 @@ public class DeviceStorageMonitorService extends SystemService {
|
||||
static final int DEVICE_MEMORY_WHAT = 1;
|
||||
static final int FORCE_MEMORY_WHAT = 2;
|
||||
private static final int MONITOR_INTERVAL = 1; //in minutes
|
||||
private static final int LOW_MEMORY_NOTIFICATION_ID = 1;
|
||||
|
||||
private static final int DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES = 12*60; //in minutes
|
||||
private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
|
||||
@@ -669,7 +670,7 @@ public class DeviceStorageMonitorService extends SystemService {
|
||||
.setChannel(TV_NOTIFICATION_CHANNEL_ID))
|
||||
.build();
|
||||
notification.flags |= Notification.FLAG_NO_CLEAR;
|
||||
notificationMgr.notifyAsUser(null, LOW_MEMORY_NOTIFICATION_ID, notification,
|
||||
notificationMgr.notifyAsUser(null, SystemMessage.NOTE_LOW_STORAGE, notification,
|
||||
UserHandle.ALL);
|
||||
Intent broadcast = new Intent(mStorageLowIntent);
|
||||
if (seq != 0) {
|
||||
@@ -688,7 +689,7 @@ public class DeviceStorageMonitorService extends SystemService {
|
||||
(NotificationManager)context.getSystemService(
|
||||
Context.NOTIFICATION_SERVICE);
|
||||
//cancel notification since memory has been freed
|
||||
mNotificationMgr.cancelAsUser(null, LOW_MEMORY_NOTIFICATION_ID, UserHandle.ALL);
|
||||
mNotificationMgr.cancelAsUser(null, SystemMessage.NOTE_LOW_STORAGE, UserHandle.ALL);
|
||||
|
||||
context.removeStickyBroadcastAsUser(mStorageLowIntent, UserHandle.ALL);
|
||||
Intent broadcast = new Intent(mStorageOkIntent);
|
||||
|
||||
@@ -39,6 +39,7 @@ import android.security.KeyChain;
|
||||
import android.security.KeyChain.KeyChainConnection;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.R;
|
||||
|
||||
@@ -52,7 +53,7 @@ import java.util.Set;
|
||||
|
||||
public class CertificateMonitor {
|
||||
protected static final String LOG_TAG = DevicePolicyManagerService.LOG_TAG;
|
||||
protected static final int MONITORING_CERT_NOTIFICATION_ID = R.plurals.ssl_ca_cert_warning;
|
||||
protected static final int MONITORING_CERT_NOTIFICATION_ID = SystemMessage.NOTE_SSL_CERT_INFO;
|
||||
|
||||
private final DevicePolicyManagerService mService;
|
||||
private final DevicePolicyManagerService.Injector mInjector;
|
||||
|
||||
@@ -165,6 +165,7 @@ import com.android.internal.R;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
@@ -261,9 +262,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
private static final String ACTION_EXPIRED_PASSWORD_NOTIFICATION
|
||||
= "com.android.server.ACTION_EXPIRED_PASSWORD_NOTIFICATION";
|
||||
|
||||
private static final int PROFILE_WIPED_NOTIFICATION_ID = 1001;
|
||||
private static final int NETWORK_LOGGING_NOTIFICATION_ID = 1002;
|
||||
|
||||
private static final String ATTR_PERMISSION_PROVIDER = "permission-provider";
|
||||
private static final String ATTR_SETUP_COMPLETE = "setup-complete";
|
||||
private static final String ATTR_PROVISIONING_STATE = "provisioning-state";
|
||||
@@ -5301,11 +5299,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
.setColor(mContext.getColor(R.color.system_notification_accent_color))
|
||||
.setStyle(new Notification.BigTextStyle().bigText(contentText))
|
||||
.build();
|
||||
mInjector.getNotificationManager().notify(PROFILE_WIPED_NOTIFICATION_ID, notification);
|
||||
mInjector.getNotificationManager().notify(SystemMessage.NOTE_PROFILE_WIPED, notification);
|
||||
}
|
||||
|
||||
private void clearWipeProfileNotification() {
|
||||
mInjector.getNotificationManager().cancel(PROFILE_WIPED_NOTIFICATION_ID);
|
||||
mInjector.getNotificationManager().cancel(SystemMessage.NOTE_PROFILE_WIPED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -10624,7 +10622,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
+ " service not being available yet.");
|
||||
}
|
||||
mNetworkLogger = null;
|
||||
mInjector.getNotificationManager().cancel(NETWORK_LOGGING_NOTIFICATION_ID);
|
||||
mInjector.getNotificationManager().cancel(SystemMessage.NOTE_NETWORK_LOGGING);
|
||||
}
|
||||
} finally {
|
||||
mInjector.binderRestoreCallingIdentity(callingIdentity);
|
||||
@@ -10751,7 +10749,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
.setStyle(new Notification.BigTextStyle()
|
||||
.bigText(mContext.getString(R.string.network_logging_notification_text)))
|
||||
.build();
|
||||
mInjector.getNotificationManager().notify(NETWORK_LOGGING_NOTIFICATION_ID, notification);
|
||||
mInjector.getNotificationManager().notify(SystemMessage.NOTE_NETWORK_LOGGING, notification);
|
||||
saveSettingsLocked(mOwners.getDeviceOwnerUserId());
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.provider.Settings;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -38,7 +39,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
*/
|
||||
class RemoteBugreportUtils {
|
||||
|
||||
static final int NOTIFICATION_ID = 678432343;
|
||||
static final int NOTIFICATION_ID = SystemMessage.NOTE_REMOTE_BUGREPORT;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
|
||||
@@ -61,6 +61,8 @@ import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.KeyValueListParser;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.R;
|
||||
@@ -621,8 +623,8 @@ public class RetailDemoModeService extends SystemService {
|
||||
|
||||
if (!mIsCarrierDemoMode) {
|
||||
// Show reset notification (except in carrier demo mode).
|
||||
mInjector.getNotificationManager().notifyAsUser(TAG,
|
||||
1, mInjector.createResetNotification(), UserHandle.of(userId));
|
||||
mInjector.getNotificationManager().notifyAsUser(TAG, SystemMessage.NOTE_RETAIL_RESET,
|
||||
mInjector.createResetNotification(), UserHandle.of(userId));
|
||||
|
||||
synchronized (mActivityLock) {
|
||||
mUserUntouched = true;
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.hardware.usb.UsbInterface;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.os.UserHandle;
|
||||
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
|
||||
/**
|
||||
@@ -101,11 +102,13 @@ class MtpNotificationManager {
|
||||
notification.flags |= Notification.FLAG_LOCAL_ONLY;
|
||||
|
||||
mContext.getSystemService(NotificationManager.class).notify(
|
||||
TAG, device.getDeviceId(), notification);
|
||||
Integer.toString(device.getDeviceId()), SystemMessage.NOTE_USB_MTP_TAP,
|
||||
notification);
|
||||
}
|
||||
|
||||
void hideNotification(int deviceId) {
|
||||
mContext.getSystemService(NotificationManager.class).cancel(TAG, deviceId);
|
||||
mContext.getSystemService(NotificationManager.class).cancel(
|
||||
Integer.toString(deviceId), SystemMessage.NOTE_USB_MTP_TAP);
|
||||
}
|
||||
|
||||
private class Receiver extends BroadcastReceiver {
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.util.Pair;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.SomeArgs;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
@@ -60,8 +61,6 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
@@ -946,35 +945,46 @@ public class UsbDeviceManager {
|
||||
return;
|
||||
}
|
||||
int id = 0;
|
||||
int titleRes = 0;
|
||||
Resources r = mContext.getResources();
|
||||
if (mConnected) {
|
||||
if (!mUsbDataUnlocked) {
|
||||
if (mSourcePower) {
|
||||
id = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
id = SystemMessage.NOTE_USB_SUPPLYING;
|
||||
} else {
|
||||
id = com.android.internal.R.string.usb_charging_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_charging_notification_title;
|
||||
id = SystemMessage.NOTE_USB_CHARGING;
|
||||
}
|
||||
} else if (UsbManager.containsFunction(mCurrentFunctions,
|
||||
UsbManager.USB_FUNCTION_MTP)) {
|
||||
id = com.android.internal.R.string.usb_mtp_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_mtp_notification_title;
|
||||
id = SystemMessage.NOTE_USB_MTP;
|
||||
} else if (UsbManager.containsFunction(mCurrentFunctions,
|
||||
UsbManager.USB_FUNCTION_PTP)) {
|
||||
id = com.android.internal.R.string.usb_ptp_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_ptp_notification_title;
|
||||
id = SystemMessage.NOTE_USB_PTP;
|
||||
} else if (UsbManager.containsFunction(mCurrentFunctions,
|
||||
UsbManager.USB_FUNCTION_MIDI)) {
|
||||
id = com.android.internal.R.string.usb_midi_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_midi_notification_title;
|
||||
id = SystemMessage.NOTE_USB_MIDI;
|
||||
} else if (UsbManager.containsFunction(mCurrentFunctions,
|
||||
UsbManager.USB_FUNCTION_ACCESSORY)) {
|
||||
id = com.android.internal.R.string.usb_accessory_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_accessory_notification_title;
|
||||
id = SystemMessage.NOTE_USB_ACCESSORY;
|
||||
} else if (mSourcePower) {
|
||||
id = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
id = SystemMessage.NOTE_USB_SUPPLYING;
|
||||
} else {
|
||||
id = com.android.internal.R.string.usb_charging_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_charging_notification_title;
|
||||
id = SystemMessage.NOTE_USB_CHARGING;
|
||||
}
|
||||
} else if (mSourcePower) {
|
||||
id = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_supplying_notification_title;
|
||||
id = SystemMessage.NOTE_USB_SUPPLYING;
|
||||
} else if (mHostConnected && mSinkPower && mUsbCharging) {
|
||||
id = com.android.internal.R.string.usb_charging_notification_title;
|
||||
titleRes = com.android.internal.R.string.usb_charging_notification_title;
|
||||
id = SystemMessage.NOTE_USB_CHARGING;
|
||||
}
|
||||
if (id != mUsbNotificationId) {
|
||||
// clear notification if title needs changing
|
||||
@@ -986,7 +996,7 @@ public class UsbDeviceManager {
|
||||
if (id != 0) {
|
||||
CharSequence message = r.getText(
|
||||
com.android.internal.R.string.usb_notification_message);
|
||||
CharSequence title = r.getText(id);
|
||||
CharSequence title = r.getText(titleRes);
|
||||
|
||||
Intent intent = Intent.makeRestartActivityTask(
|
||||
new ComponentName("com.android.settings",
|
||||
@@ -1018,7 +1028,7 @@ public class UsbDeviceManager {
|
||||
|
||||
private void updateAdbNotification() {
|
||||
if (mNotificationManager == null) return;
|
||||
final int id = com.android.internal.R.string.adb_active_notification_title;
|
||||
final int id = SystemMessage.NOTE_ADB_ACTIVE;
|
||||
if (mAdbEnabled && mConnected) {
|
||||
if ("0".equals(SystemProperties.get("persist.adb.notify"))) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user