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

Commit 9f4e4072 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Remove old alarm IPC" into pi-dev

am: ae6b8005

Change-Id: I60977022c6075e1fa3aa27156733eb41891e5b26
parents 7d64fc41 ae6b8005
Loading
Loading
Loading
Loading
+3 −12
Original line number Original line Diff line number Diff line
@@ -54,7 +54,6 @@ public class KeyguardStatusView extends GridLayout {
    private static final int MARQUEE_DELAY_MS = 2000;
    private static final int MARQUEE_DELAY_MS = 2000;


    private final LockPatternUtils mLockPatternUtils;
    private final LockPatternUtils mLockPatternUtils;
    private final AlarmManager mAlarmManager;
    private final IActivityManager mIActivityManager;
    private final IActivityManager mIActivityManager;
    private final float mSmallClockScale;
    private final float mSmallClockScale;
    private final float mWidgetPadding;
    private final float mWidgetPadding;
@@ -123,7 +122,6 @@ public class KeyguardStatusView extends GridLayout {


    public KeyguardStatusView(Context context, AttributeSet attrs, int defStyle) {
    public KeyguardStatusView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        super(context, attrs, defStyle);
        mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
        mIActivityManager = ActivityManager.getService();
        mIActivityManager = ActivityManager.getService();
        mLockPatternUtils = new LockPatternUtils(getContext());
        mLockPatternUtils = new LockPatternUtils(getContext());
        mHandler = new Handler(Looper.myLooper());
        mHandler = new Handler(Looper.myLooper());
@@ -223,10 +221,7 @@ public class KeyguardStatusView extends GridLayout {
    }
    }


    private void refresh() {
    private void refresh() {
        AlarmManager.AlarmClockInfo nextAlarm =
        Patterns.update(mContext);
                mAlarmManager.getNextAlarmClock(UserHandle.USER_CURRENT);
        Patterns.update(mContext, nextAlarm != null);

        refreshTime();
        refreshTime();
    }
    }


@@ -301,20 +296,16 @@ public class KeyguardStatusView extends GridLayout {
    // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often.
    // DateFormat.getBestDateTimePattern is extremely expensive, and refresh is called often.
    // This is an optimization to ensure we only recompute the patterns when the inputs change.
    // This is an optimization to ensure we only recompute the patterns when the inputs change.
    private static final class Patterns {
    private static final class Patterns {
        static String dateViewSkel;
        static String clockView12;
        static String clockView12;
        static String clockView24;
        static String clockView24;
        static String cacheKey;
        static String cacheKey;


        static void update(Context context, boolean hasAlarm) {
        static void update(Context context) {
            final Locale locale = Locale.getDefault();
            final Locale locale = Locale.getDefault();
            final Resources res = context.getResources();
            final Resources res = context.getResources();
            dateViewSkel = res.getString(hasAlarm
                    ? R.string.abbrev_wday_month_day_no_year_alarm
                    : R.string.abbrev_wday_month_day_no_year);
            final String clockView12Skel = res.getString(R.string.clock_12hr_format);
            final String clockView12Skel = res.getString(R.string.clock_12hr_format);
            final String clockView24Skel = res.getString(R.string.clock_24hr_format);
            final String clockView24Skel = res.getString(R.string.clock_24hr_format);
            final String key = locale.toString() + dateViewSkel + clockView12Skel + clockView24Skel;
            final String key = locale.toString() + clockView12Skel + clockView24Skel;
            if (key.equals(cacheKey)) return;
            if (key.equals(cacheKey)) return;


            clockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel);
            clockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel);