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

Commit 1f276918 authored by Andrew Sapperstein's avatar Andrew Sapperstein Committed by Android (Google) Code Review
Browse files

Merge "Create a global registry for system message IDs" into nyc-mr2-dev

parents c65a010a 117d5b4f
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -40,11 +40,7 @@
    <item type="id" name="scrim_target"/>
    <item type="id" name="scrim_alpha_start"/>
    <item type="id" name="scrim_alpha_end"/>
    <item type="id" name="notification_power"/>
    <item type="id" name="notification_screenshot"/>
    <item type="id" name="notification_hidden"/>
    <item type="id" name="notification_volumeui"/>
    <item type="id" name="notification_temperature"/>
    <item type="id" name="transformation_start_x_tag"/>
    <item type="id" name="transformation_start_y_tag"/>
    <item type="id" name="transformation_start_scale_x_tag"/>
+13 −10
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.util.Slog;

import com.android.internal.messages.SystemMessageProto.SystemMessage;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.phone.PhoneStatusBar;
@@ -49,8 +50,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
    private static final String TAG = PowerUI.TAG + ".Notification";
    private static final boolean DEBUG = PowerUI.DEBUG;

    private static final String TAG_NOTIFICATION_BATTERY = "low_battery";
    private static final String TAG_NOTIFICATION_TEMPERATURE = "high_temp";
    private static final String TAG_BATTERY = "low_battery";
    private static final String TAG_TEMPERATURE = "high_temp";

    private static final int SHOWING_NOTHING = 0;
    private static final int SHOWING_WARNING = 1;
@@ -134,7 +135,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
            showWarningNotification();
            mShowing = SHOWING_WARNING;
        } else {
            mNoMan.cancelAsUser(TAG_NOTIFICATION_BATTERY, R.id.notification_power, UserHandle.ALL);
            mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, UserHandle.ALL);
            mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, UserHandle.ALL);
            mShowing = SHOWING_NOTHING;
        }
    }
@@ -153,7 +155,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
                        com.android.internal.R.color.system_notification_accent_color));
        SystemUI.overrideNotificationAppName(mContext, nb);
        final Notification n = nb.build();
        mNoMan.notifyAsUser(TAG_NOTIFICATION_BATTERY, R.id.notification_power, n, UserHandle.ALL);
        mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, UserHandle.ALL);
        mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, n, UserHandle.ALL);
    }

    private void showWarningNotification() {
@@ -183,8 +186,9 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
            mPlaySound = false;
        }
        SystemUI.overrideNotificationAppName(mContext, nb);
        mNoMan.notifyAsUser(
                TAG_NOTIFICATION_BATTERY, R.id.notification_power, nb.build(), UserHandle.ALL);
        final Notification n = nb.build();
        mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, UserHandle.ALL);
        mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, n, UserHandle.ALL);
    }

    private PendingIntent pendingBroadcast(String action) {
@@ -211,8 +215,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
            return;
        }
        mTempWarning = false;
        mNoMan.cancelAsUser(
                TAG_NOTIFICATION_TEMPERATURE, R.id.notification_temperature, UserHandle.ALL);
        mNoMan.cancelAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP,
                UserHandle.ALL);
    }

    @Override
@@ -235,8 +239,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
                        com.android.internal.R.color.battery_saver_mode_color));
        SystemUI.overrideNotificationAppName(mContext, nb);
        final Notification n = nb.build();
        mNoMan.notifyAsUser(
                TAG_NOTIFICATION_TEMPERATURE, R.id.notification_temperature, n, UserHandle.ALL);
        mNoMan.notifyAsUser(TAG_TEMPERATURE, SystemMessage.NOTE_HIGH_TEMP, n, UserHandle.ALL);

    }

+9 −6
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.view.WindowManager;
import android.view.animation.Interpolator;
import android.widget.ImageView;

import com.android.internal.messages.SystemMessageProto.SystemMessage;
import com.android.systemui.R;
import com.android.systemui.SystemUI;

@@ -201,7 +202,8 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
        mNotificationBuilder.setFlag(Notification.FLAG_NO_CLEAR, true);
        SystemUI.overrideNotificationAppName(context, mNotificationBuilder);

        mNotificationManager.notify(R.id.notification_screenshot, mNotificationBuilder.build());
        mNotificationManager.notify(SystemMessage.NOTE_GLOBAL_SCREENSHOT,
                mNotificationBuilder.build());

        /**
         * NOTE: The following code prepares the notification builder for updating the notification
@@ -347,7 +349,8 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
                .setPublicVersion(mPublicNotificationBuilder.build())
                .setFlag(Notification.FLAG_NO_CLEAR, false);

            mNotificationManager.notify(R.id.notification_screenshot, mNotificationBuilder.build());
            mNotificationManager.notify(SystemMessage.NOTE_GLOBAL_SCREENSHOT,
                    mNotificationBuilder.build());
        }
        mParams.finisher.run();
        mParams.clearContext();
@@ -363,7 +366,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
        mParams.clearContext();

        // Cancel the posted notification
        mNotificationManager.cancel(R.id.notification_screenshot);
        mNotificationManager.cancel(SystemMessage.NOTE_GLOBAL_SCREENSHOT);
    }
}

@@ -865,7 +868,7 @@ class GlobalScreenshot {
        Notification n = new Notification.BigTextStyle(b)
                .bigText(errorMsg)
                .build();
        nManager.notify(R.id.notification_screenshot, n);
        nManager.notify(SystemMessage.NOTE_GLOBAL_SCREENSHOT, n);
    }

    /**
@@ -877,7 +880,7 @@ class GlobalScreenshot {
            // Clear the notification
            final NotificationManager nm =
                    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            nm.cancel(R.id.notification_screenshot);
            nm.cancel(SystemMessage.NOTE_GLOBAL_SCREENSHOT);
        }
    }

@@ -895,7 +898,7 @@ class GlobalScreenshot {
            final NotificationManager nm =
                    (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
            final Uri uri = Uri.parse(intent.getStringExtra(SCREENSHOT_URI_ID));
            nm.cancel(R.id.notification_screenshot);
            nm.cancel(SystemMessage.NOTE_GLOBAL_SCREENSHOT);

            // And delete the image from the media store
            new DeleteImageInBackgroundTask(context).execute(uri);
+3 −2
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import android.widget.Toast;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.messages.SystemMessageProto.SystemMessage;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.widget.LockPatternUtils;
@@ -551,7 +552,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(R.id.notification_hidden);
                noMan.cancel(SystemMessage.NOTE_HIDDEN_NOTIFICATIONS);

                Settings.Secure.putInt(mContext.getContentResolver(),
                        Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 0);
@@ -882,7 +883,7 @@ public abstract class BaseStatusBar extends SystemUI implements

            NotificationManager noMan =
                    (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
            noMan.notify(R.id.notification_hidden, note.build());
            noMan.notify(SystemMessage.NOTE_HIDDEN_NOTIFICATIONS, note.build());
        }
    }

+5 −6
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.messages.SystemMessageProto.SystemMessage;
import com.android.internal.util.UserIcons;
import com.android.settingslib.RestrictedLockUtils;
import com.android.systemui.GuestResumeSessionReceiver;
@@ -79,8 +80,6 @@ public class UserSwitcherController {
    private static final String ACTION_LOGOUT_USER = "com.android.systemui.LOGOUT_USER";
    private static final int PAUSE_REFRESH_USERS_TIMEOUT_MS = 3000;

    private static final int ID_REMOVE_GUEST = 1010;
    private static final int ID_LOGOUT_USER = 1011;
    private static final String TAG_REMOVE_GUEST = "remove_guest";
    private static final String TAG_LOGOUT_USER = "logout_user";

@@ -553,8 +552,8 @@ public class UserSwitcherController {
                            mContext.getString(R.string.user_logout_notification_action),
                            logoutPI);
            SystemUI.overrideNotificationAppName(mContext, builder);
            NotificationManager.from(mContext).notifyAsUser(TAG_LOGOUT_USER, ID_LOGOUT_USER,
                    builder.build(), new UserHandle(userId));
            NotificationManager.from(mContext).notifyAsUser(TAG_LOGOUT_USER,
                    SystemMessage.NOTE_LOGOUT_USER, builder.build(), new UserHandle(userId));
        }
    };

@@ -576,8 +575,8 @@ public class UserSwitcherController {
                        mContext.getString(R.string.guest_notification_remove_action),
                        removeGuestPI);
        SystemUI.overrideNotificationAppName(mContext, builder);
        NotificationManager.from(mContext).notifyAsUser(TAG_REMOVE_GUEST, ID_REMOVE_GUEST,
                builder.build(), new UserHandle(guestUserId));
        NotificationManager.from(mContext).notifyAsUser(TAG_REMOVE_GUEST,
                SystemMessage.NOTE_REMOVE_GUEST, builder.build(), new UserHandle(guestUserId));
    }

    private final Runnable mUnpauseRefreshUsers = new Runnable() {
Loading