Loading core/java/android/app/ActivityThread.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -1309,8 +1309,19 @@ public final class ActivityThread { } } @Override @Override public final void updateTimePrefs(boolean is24Hour) { public final void updateTimePrefs(int timeFormatPreference) { DateFormat.set24HourTimePref(is24Hour); final Boolean timeFormatPreferenceBool; // For convenience we are using the Intent extra values. if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { timeFormatPreferenceBool = Boolean.FALSE; } else if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_24_HOUR) { timeFormatPreferenceBool = Boolean.TRUE; } else { // timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT // (or unknown). timeFormatPreferenceBool = null; } DateFormat.set24HourTimePref(timeFormatPreferenceBool); } } @Override @Override Loading core/java/android/app/IApplicationThread.aidl +2 −2 Original line number Original line Diff line number Diff line Loading @@ -138,7 +138,7 @@ oneway interface IApplicationThread { void scheduleTranslucentConversionComplete(IBinder token, boolean timeout); void scheduleTranslucentConversionComplete(IBinder token, boolean timeout); void setProcessState(int state); void setProcessState(int state); void scheduleInstallProvider(in ProviderInfo provider); void scheduleInstallProvider(in ProviderInfo provider); void updateTimePrefs(boolean is24Hour); void updateTimePrefs(int timeFormatPreference); void scheduleCancelVisibleBehind(IBinder token); void scheduleCancelVisibleBehind(IBinder token); void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled); void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled); void scheduleEnterAnimationComplete(IBinder token); void scheduleEnterAnimationComplete(IBinder token); Loading core/java/android/content/Intent.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -4186,13 +4186,21 @@ public class Intent implements Parcelable, Cloneable { = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; /** /** * Optional boolean extra for {@link #ACTION_TIME_CHANGED} that indicates the * Optional int extra for {@link #ACTION_TIME_CHANGED} that indicates the * user has set their time format preferences to the 24 hour format. * 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 * {@link #EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT}. The value must not be negative. * * * @hide for internal use only. * @hide for internal use only. */ */ public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_12_HOUR = 0; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_24_HOUR = 1; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT = 2; /** {@hide} */ /** {@hide} */ public static final String EXTRA_REASON = "android.intent.extra.REASON"; public static final String EXTRA_REASON = "android.intent.extra.REASON"; Loading services/core/java/com/android/server/am/ActivityManagerService.java +22 −10 Original line number Original line Diff line number Diff line Loading @@ -1520,7 +1520,7 @@ public class ActivityManagerService extends IActivityManager.Stub static final int PERSIST_URI_GRANTS_MSG = 38; static final int PERSIST_URI_GRANTS_MSG = 38; static final int REQUEST_ALL_PSS_MSG = 39; static final int REQUEST_ALL_PSS_MSG = 39; static final int START_PROFILES_MSG = 40; static final int START_PROFILES_MSG = 40; static final int UPDATE_TIME = 41; static final int UPDATE_TIME_PREFERENCE_MSG = 41; static final int SYSTEM_USER_START_MSG = 42; static final int SYSTEM_USER_START_MSG = 42; static final int SYSTEM_USER_CURRENT_MSG = 43; static final int SYSTEM_USER_CURRENT_MSG = 43; static final int ENTER_ANIMATION_COMPLETE_MSG = 44; static final int ENTER_ANIMATION_COMPLETE_MSG = 44; Loading Loading @@ -2026,15 +2026,18 @@ public class ActivityManagerService extends IActivityManager.Stub } } break; break; } } case UPDATE_TIME: { case UPDATE_TIME_PREFERENCE_MSG: { // The user's time format preference might have changed. // For convenience we re-use the Intent extra values. synchronized (ActivityManagerService.this) { synchronized (ActivityManagerService.this) { for (int i = mLruProcesses.size() - 1; i >= 0; i--) { for (int i = mLruProcesses.size() - 1; i >= 0; i--) { ProcessRecord r = mLruProcesses.get(i); ProcessRecord r = mLruProcesses.get(i); if (r.thread != null) { if (r.thread != null) { try { try { r.thread.updateTimePrefs(msg.arg1 == 0 ? false : true); r.thread.updateTimePrefs(msg.arg1); } catch (RemoteException ex) { } catch (RemoteException ex) { Slog.w(TAG, "Failed to update preferences for: " + r.info.processName); Slog.w(TAG, "Failed to update preferences for: " + r.info.processName); } } } } } } Loading Loading @@ -18169,11 +18172,20 @@ public class ActivityManagerService extends IActivityManager.Stub mHandler.sendEmptyMessage(UPDATE_TIME_ZONE); mHandler.sendEmptyMessage(UPDATE_TIME_ZONE); break; break; case Intent.ACTION_TIME_CHANGED: case Intent.ACTION_TIME_CHANGED: // If the user set the time, let all running processes know. // EXTRA_TIME_PREF_24_HOUR_FORMAT is optional so we must distinguish between final int is24Hour = // the tri-state value it may contain and "unknown". intent.getBooleanExtra(Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 // For convenience we re-use the Intent extra values. : 0; final int NO_EXTRA_VALUE_FOUND = -1; mHandler.sendMessage(mHandler.obtainMessage(UPDATE_TIME, is24Hour, 0)); final int timeFormatPreferenceMsgValue = intent.getIntExtra( Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, NO_EXTRA_VALUE_FOUND /* defaultValue */); // Only send a message if the time preference is available. if (timeFormatPreferenceMsgValue != NO_EXTRA_VALUE_FOUND) { Message updateTimePreferenceMsg = mHandler.obtainMessage(UPDATE_TIME_PREFERENCE_MSG, timeFormatPreferenceMsgValue, 0); mHandler.sendMessage(updateTimePreferenceMsg); } BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); synchronized (stats) { synchronized (stats) { stats.noteCurrentTimeChangedLocked(); stats.noteCurrentTimeChangedLocked(); Loading
core/java/android/app/ActivityThread.java +13 −2 Original line number Original line Diff line number Diff line Loading @@ -1309,8 +1309,19 @@ public final class ActivityThread { } } @Override @Override public final void updateTimePrefs(boolean is24Hour) { public final void updateTimePrefs(int timeFormatPreference) { DateFormat.set24HourTimePref(is24Hour); final Boolean timeFormatPreferenceBool; // For convenience we are using the Intent extra values. if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR) { timeFormatPreferenceBool = Boolean.FALSE; } else if (timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_24_HOUR) { timeFormatPreferenceBool = Boolean.TRUE; } else { // timeFormatPreference == Intent.EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT // (or unknown). timeFormatPreferenceBool = null; } DateFormat.set24HourTimePref(timeFormatPreferenceBool); } } @Override @Override Loading
core/java/android/app/IApplicationThread.aidl +2 −2 Original line number Original line Diff line number Diff line Loading @@ -138,7 +138,7 @@ oneway interface IApplicationThread { void scheduleTranslucentConversionComplete(IBinder token, boolean timeout); void scheduleTranslucentConversionComplete(IBinder token, boolean timeout); void setProcessState(int state); void setProcessState(int state); void scheduleInstallProvider(in ProviderInfo provider); void scheduleInstallProvider(in ProviderInfo provider); void updateTimePrefs(boolean is24Hour); void updateTimePrefs(int timeFormatPreference); void scheduleCancelVisibleBehind(IBinder token); void scheduleCancelVisibleBehind(IBinder token); void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled); void scheduleBackgroundVisibleBehindChanged(IBinder token, boolean enabled); void scheduleEnterAnimationComplete(IBinder token); void scheduleEnterAnimationComplete(IBinder token); Loading
core/java/android/content/Intent.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -4186,13 +4186,21 @@ public class Intent implements Parcelable, Cloneable { = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"; /** /** * Optional boolean extra for {@link #ACTION_TIME_CHANGED} that indicates the * Optional int extra for {@link #ACTION_TIME_CHANGED} that indicates the * user has set their time format preferences to the 24 hour format. * 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 * {@link #EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT}. The value must not be negative. * * * @hide for internal use only. * @hide for internal use only. */ */ public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = public static final String EXTRA_TIME_PREF_24_HOUR_FORMAT = "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; "android.intent.extra.TIME_PREF_24_HOUR_FORMAT"; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_12_HOUR = 0; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_24_HOUR = 1; /** @hide */ public static final int EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT = 2; /** {@hide} */ /** {@hide} */ public static final String EXTRA_REASON = "android.intent.extra.REASON"; public static final String EXTRA_REASON = "android.intent.extra.REASON"; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +22 −10 Original line number Original line Diff line number Diff line Loading @@ -1520,7 +1520,7 @@ public class ActivityManagerService extends IActivityManager.Stub static final int PERSIST_URI_GRANTS_MSG = 38; static final int PERSIST_URI_GRANTS_MSG = 38; static final int REQUEST_ALL_PSS_MSG = 39; static final int REQUEST_ALL_PSS_MSG = 39; static final int START_PROFILES_MSG = 40; static final int START_PROFILES_MSG = 40; static final int UPDATE_TIME = 41; static final int UPDATE_TIME_PREFERENCE_MSG = 41; static final int SYSTEM_USER_START_MSG = 42; static final int SYSTEM_USER_START_MSG = 42; static final int SYSTEM_USER_CURRENT_MSG = 43; static final int SYSTEM_USER_CURRENT_MSG = 43; static final int ENTER_ANIMATION_COMPLETE_MSG = 44; static final int ENTER_ANIMATION_COMPLETE_MSG = 44; Loading Loading @@ -2026,15 +2026,18 @@ public class ActivityManagerService extends IActivityManager.Stub } } break; break; } } case UPDATE_TIME: { case UPDATE_TIME_PREFERENCE_MSG: { // The user's time format preference might have changed. // For convenience we re-use the Intent extra values. synchronized (ActivityManagerService.this) { synchronized (ActivityManagerService.this) { for (int i = mLruProcesses.size() - 1; i >= 0; i--) { for (int i = mLruProcesses.size() - 1; i >= 0; i--) { ProcessRecord r = mLruProcesses.get(i); ProcessRecord r = mLruProcesses.get(i); if (r.thread != null) { if (r.thread != null) { try { try { r.thread.updateTimePrefs(msg.arg1 == 0 ? false : true); r.thread.updateTimePrefs(msg.arg1); } catch (RemoteException ex) { } catch (RemoteException ex) { Slog.w(TAG, "Failed to update preferences for: " + r.info.processName); Slog.w(TAG, "Failed to update preferences for: " + r.info.processName); } } } } } } Loading Loading @@ -18169,11 +18172,20 @@ public class ActivityManagerService extends IActivityManager.Stub mHandler.sendEmptyMessage(UPDATE_TIME_ZONE); mHandler.sendEmptyMessage(UPDATE_TIME_ZONE); break; break; case Intent.ACTION_TIME_CHANGED: case Intent.ACTION_TIME_CHANGED: // If the user set the time, let all running processes know. // EXTRA_TIME_PREF_24_HOUR_FORMAT is optional so we must distinguish between final int is24Hour = // the tri-state value it may contain and "unknown". intent.getBooleanExtra(Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 // For convenience we re-use the Intent extra values. : 0; final int NO_EXTRA_VALUE_FOUND = -1; mHandler.sendMessage(mHandler.obtainMessage(UPDATE_TIME, is24Hour, 0)); final int timeFormatPreferenceMsgValue = intent.getIntExtra( Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, NO_EXTRA_VALUE_FOUND /* defaultValue */); // Only send a message if the time preference is available. if (timeFormatPreferenceMsgValue != NO_EXTRA_VALUE_FOUND) { Message updateTimePreferenceMsg = mHandler.obtainMessage(UPDATE_TIME_PREFERENCE_MSG, timeFormatPreferenceMsgValue, 0); mHandler.sendMessage(updateTimePreferenceMsg); } BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics(); synchronized (stats) { synchronized (stats) { stats.noteCurrentTimeChangedLocked(); stats.noteCurrentTimeChangedLocked();