diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/content/Intent.java | 13 | ||||
| -rw-r--r-- | core/java/android/widget/AnalogClock.java | 2 | ||||
| -rw-r--r-- | core/java/android/widget/TextClock.java | 2 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java | 2 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/AlarmManagerService.java | 2 |
7 files changed, 19 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt index 542a714be8e1..c1bddcc7ed56 100644 --- a/api/current.txt +++ b/api/current.txt @@ -10806,6 +10806,7 @@ package android.content { field public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"; field public static final String EXTRA_TEXT = "android.intent.extra.TEXT"; field public static final String EXTRA_TIME = "android.intent.extra.TIME"; + field public static final String EXTRA_TIMEZONE = "time-zone"; field public static final String EXTRA_TITLE = "android.intent.extra.TITLE"; field public static final String EXTRA_UID = "android.intent.extra.UID"; field public static final String EXTRA_USER = "android.intent.extra.USER"; @@ -82234,3 +82235,4 @@ package org.xmlpull.v1.sax2 { } } + diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 4bb7346d6416..38c1890cfc42 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -26,6 +26,7 @@ import android.annotation.Nullable; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; +import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.TestApi; import android.app.AppGlobals; @@ -86,6 +87,7 @@ import java.util.List; import java.util.Locale; import java.util.Objects; import java.util.Set; +import java.util.TimeZone; /** * An intent is an abstract description of an operation to be performed. It @@ -2312,7 +2314,8 @@ public class Intent implements Parcelable, Cloneable { /** * Broadcast Action: The timezone has changed. The intent will have the following extra values:</p> * <ul> - * <li><em>time-zone</em> - The java.util.TimeZone.getID() value identifying the new time zone.</li> + * <li>{@link #EXTRA_TIMEZONE} - The java.util.TimeZone.getID() value identifying the new + * time zone.</li> * </ul> * * <p class="note">This is a protected intent that can only be sent @@ -5785,6 +5788,14 @@ public class Intent implements Parcelable, Cloneable { public static final String EXTRA_TIME = "android.intent.extra.TIME"; /** + * Extra sent with {@link #ACTION_TIMEZONE_CHANGED} specifying the new time zone of the device. + * + * <p>Type: String, the same as returned by {@link TimeZone#getID()} to identify time zones. + */ + @SuppressLint("ActionValue") + public static final String EXTRA_TIMEZONE = "time-zone"; + + /** * Optional int extra for {@link #ACTION_TIME_CHANGED} that indicates the * user has set their time format preference. See {@link #EXTRA_TIME_PREF_VALUE_USE_12_HOUR}, * {@link #EXTRA_TIME_PREF_VALUE_USE_24_HOUR} and diff --git a/core/java/android/widget/AnalogClock.java b/core/java/android/widget/AnalogClock.java index d165bd0f0fa7..ffdb89de5f59 100644 --- a/core/java/android/widget/AnalogClock.java +++ b/core/java/android/widget/AnalogClock.java @@ -261,7 +261,7 @@ public class AnalogClock extends View { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED)) { - String tz = intent.getStringExtra("time-zone"); + String tz = intent.getStringExtra(Intent.EXTRA_TIMEZONE); mClock = Clock.system(ZoneId.of(tz)); } diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java index 85654931a975..6432438b6630 100644 --- a/core/java/android/widget/TextClock.java +++ b/core/java/android/widget/TextClock.java @@ -173,7 +173,7 @@ public class TextClock extends TextView { return; // Test disabled the clock ticks } if (mTimeZone == null && Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) { - final String timeZone = intent.getStringExtra("time-zone"); + final String timeZone = intent.getStringExtra(Intent.EXTRA_TIMEZONE); createTime(timeZone); } else if (!mShouldRunTicker && (Intent.ACTION_TIME_TICK.equals(intent.getAction()) || Intent.ACTION_TIME_CHANGED.equals(intent.getAction()))) { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 4508fc74e884..2bae62e4398e 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1086,7 +1086,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mHandler.sendEmptyMessage(MSG_TIME_UPDATE); } else if (Intent.ACTION_TIMEZONE_CHANGED.equals(action)) { final Message msg = mHandler.obtainMessage( - MSG_TIMEZONE_UPDATE, intent.getStringExtra("time-zone")); + MSG_TIMEZONE_UPDATE, intent.getStringExtra(Intent.EXTRA_TIMEZONE)); mHandler.sendMessage(msg); } else if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index 759bad4f77b7..812ce1c62677 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -236,7 +236,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C String action = intent.getAction(); if (action.equals(Intent.ACTION_TIMEZONE_CHANGED)) { - String tz = intent.getStringExtra("time-zone"); + String tz = intent.getStringExtra(Intent.EXTRA_TIMEZONE); handler.post(() -> { mCalendar = Calendar.getInstance(TimeZone.getTimeZone(tz)); if (mClockFormat != null) { diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index 7840b1957031..9b04e7931f7c 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -1672,7 +1672,7 @@ class AlarmManagerService extends SystemService { | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS); - intent.putExtra("time-zone", zone.getID()); + intent.putExtra(Intent.EXTRA_TIMEZONE, zone.getID()); getContext().sendBroadcastAsUser(intent, UserHandle.ALL); } } |