summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2015-01-16 16:16:43 -0500
committerChris Wren <cwren@android.com>2015-01-16 16:19:32 -0500
commitd8775100b28fd1c0cc7380226a8b2c7c312e28f7 (patch)
tree8bce9691a71b1440c98463941a98dc2bc51a9970
parentdbf22ccd92dc95e7c93c0485be4bcfb5c966578a (diff)
downloadframeworks_base-d8775100b28fd1c0cc7380226a8b2c7c312e28f7.zip
frameworks_base-d8775100b28fd1c0cc7380226a8b2c7c312e28f7.tar.gz
frameworks_base-d8775100b28fd1c0cc7380226a8b2c7c312e28f7.tar.bz2
Standardize notification IDs in the sysui package.
Use the resource system to assign IDs for notifications, so that we know there will be no collisions. Bug: 10671709 Change-Id: I403e89f6ec953f6e2e63520b86e2cd464ebce6b3
-rw-r--r--packages/SystemUI/res/values/ids.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java5
4 files changed, 11 insertions, 11 deletions
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 033a90e..68dc269 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -37,5 +37,8 @@
<item type="id" name="doze_saved_filter_tag"/>
<item type="id" name="qs_icon_tag"/>
<item type="id" name="scrim"/>
+ <item type="id" name="notification_power"/>
+ <item type="id" name="notification_screenshot"/>
+ <item type="id" name="notification_hidden"/>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index 4391bfc..63dd17f 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -50,7 +50,6 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
private static final boolean DEBUG = PowerUI.DEBUG;
private static final String TAG_NOTIFICATION = "low_battery";
- private static final int ID_NOTIFICATION = 100;
private static final int SHOWING_NOTHING = 0;
private static final int SHOWING_WARNING = 1;
@@ -145,7 +144,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
showSaverNotification();
mShowing = SHOWING_SAVER;
} else {
- mNoMan.cancelAsUser(TAG_NOTIFICATION, ID_NOTIFICATION, UserHandle.ALL);
+ mNoMan.cancelAsUser(TAG_NOTIFICATION, R.id.notification_power, UserHandle.ALL);
mShowing = SHOWING_NOTHING;
}
}
@@ -166,7 +165,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
if (n.headsUpContentView != null) {
n.headsUpContentView.setViewVisibility(com.android.internal.R.id.right_icon, View.GONE);
}
- mNoMan.notifyAsUser(TAG_NOTIFICATION, ID_NOTIFICATION, n, UserHandle.ALL);
+ mNoMan.notifyAsUser(TAG_NOTIFICATION, R.id.notification_power, n, UserHandle.ALL);
}
private void showWarningNotification() {
@@ -204,7 +203,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
if (n.headsUpContentView != null) {
n.headsUpContentView.setViewVisibility(com.android.internal.R.id.right_icon, View.GONE);
}
- mNoMan.notifyAsUser(TAG_NOTIFICATION, ID_NOTIFICATION, n, UserHandle.ALL);
+ mNoMan.notifyAsUser(TAG_NOTIFICATION, R.id.notification_power, n, UserHandle.ALL);
}
private void showSaverNotification() {
@@ -221,7 +220,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
if (hasSaverSettings()) {
nb.setContentIntent(pendingActivity(mOpenSaverSettings));
}
- mNoMan.notifyAsUser(TAG_NOTIFICATION, ID_NOTIFICATION, nb.build(), UserHandle.ALL);
+ mNoMan.notifyAsUser(TAG_NOTIFICATION, R.id.notification_power, nb.build(), UserHandle.ALL);
}
private void addStopSaverAction(Notification.Builder nb) {
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index d9fea47..1b71668 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -341,7 +341,6 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi
class GlobalScreenshot {
private static final String TAG = "GlobalScreenshot";
- private static final int SCREENSHOT_NOTIFICATION_ID = 789;
private static final int SCREENSHOT_FLASH_TO_PEAK_DURATION = 130;
private static final int SCREENSHOT_DROP_IN_DURATION = 430;
private static final int SCREENSHOT_DROP_OUT_DELAY = 500;
@@ -464,7 +463,7 @@ class GlobalScreenshot {
mSaveInBgTask.cancel(false);
}
mSaveInBgTask = new SaveImageInBackgroundTask(mContext, data, mNotificationManager,
- SCREENSHOT_NOTIFICATION_ID).execute(data);
+ R.id.notification_screenshot).execute(data);
}
/**
@@ -731,6 +730,6 @@ class GlobalScreenshot {
new Notification.BigTextStyle(b)
.bigText(r.getString(R.string.screenshot_failed_text))
.build();
- nManager.notify(SCREENSHOT_NOTIFICATION_ID, n);
+ nManager.notify(R.id.notification_screenshot, n);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 21d70ba..d61908f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -140,7 +140,6 @@ public abstract class BaseStatusBar extends SystemUI implements
public static final int EXPANDED_LEAVE_ALONE = -10000;
public static final int EXPANDED_FULL_OPEN = -10001;
- private static final int HIDDEN_NOTIFICATION_ID = 10000;
private static final String BANNER_ACTION_CANCEL =
"com.android.systemui.statusbar.banner_action_cancel";
private static final String BANNER_ACTION_SETUP =
@@ -387,7 +386,7 @@ public abstract class BaseStatusBar extends SystemUI implements
} else if (BANNER_ACTION_CANCEL.equals(action) || BANNER_ACTION_SETUP.equals(action)) {
NotificationManager noMan = (NotificationManager)
mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- noMan.cancel(HIDDEN_NOTIFICATION_ID);
+ noMan.cancel(R.id.notification_hidden);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 0);
@@ -658,7 +657,7 @@ public abstract class BaseStatusBar extends SystemUI implements
NotificationManager noMan =
(NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
- noMan.notify(HIDDEN_NOTIFICATION_ID, note.build());
+ noMan.notify(R.id.notification_hidden, note.build());
}
}