Change EXTRA_TIME_PREF_24_HOUR_FORMAT from boolean to int
... on Intent.ACTION_TIME_CHANGED. This is to better represent the possible settings values for the "use 24 hour format" setting. These are "12" (use 12 hour formatting), "24" (use 24 hour formatting), unset (use locale default formatting). The EXTRA_TIME_PREF_24_HOUR_FORMAT for the ACTION_TIME_CHANGED is now an int, not a boolean. 0 means "12", 1 means "24" and 2 means "use locale default". This is not a backwards compatible change but the EXTRA_TIME_PREF_24_HOUR_FORMAT is not public and so should only affect platform code that generates or consumes the intent like settings code. There are associated changes to Settings code to update the source of the Intent. The related underlying code that is triggered in response to the intent and previously assumed a boolean now takes a Boolean. Other changes: The ActivityManagerService now only sends a binder notification to running services if the EXTRA_TIME_PREF_24_HOUR_FORMAT is present. There is an example of ACTION_TIME_CHANGED being sent from the platform (AlarmManagerService, when the system clock is noticed to have changed independently of the RTC) that does not set the extra and would previously have misinterpreted to mean "user wants 12 hour formatting", which would have been a bug. i.e. the code from ActivityManagerService that would interpret the missing extra as false: final int is24Hour = intent.getBooleanExtra( Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, false) ? 1 : 0; Some methods and constants have be renamed to better reflect their use. Bug: 32761619 Bug: 32933009 Test: Manual testing Change-Id: Ie7e9c62ce65e7e3a056b2751b45fe6cb9de86498
Loading
Please register or sign in to comment