Making time-zone an API constant am: 2e7408eddb
Change-Id: I92458f87eb0963330f98a3fe20c3336391e3f5b0
This commit is contained in:
@@ -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";
|
||||
@@ -82235,3 +82236,4 @@ package org.xmlpull.v1.sax2 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -5784,6 +5787,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},
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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()))) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user