summaryrefslogtreecommitdiff
path: root/src/com/android/alarmclock/DigitalAppWidgetProvider.java
AgeCommit message (Collapse)Author
2022-04-18DeskClock: Add FLAG_IMMUTABLEMichael W
* As per recommendations Change-Id: I467c5eec9e7de1cb8084a173e942832c6ac44e27
2021-10-09DeskClock: Squashed AOSP changes before java app was removed.Colin Marsch
* This includes all the java changes that were made to DeskClock during the conversion to kotlin. Squash of the following: AOSP/DeskClock - Add Kotlin code for alarmclock/ files Test: none currently, DeskClockKotlin target builds successfully, testing is a work in progress BUG: 157255731 Original-Change-Id: I4c245d209ac733c4fb5ec527bc9ed84444b8cbd6 AOSP/DeskClock - Add Kotlin file for DataModel Test: manual - Ran the following on Sargo phone. Tested all app interactions (alarms, stopwatch, timer, cities, settings). $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin -j $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk BUG: 157255731 Original-Change-Id: I2fe53bbdddc9f473ece01bacb386e9ad08efcdc7 AOSP/DeskClock - Add Kotlin file for RingtonePickerActivity Test: manual testing by running the following (1) on Sargo phone and testing the UI, also unit tests ran as follows (2) (1) $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin -j $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk (2) $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: I1eff3fe6e19a19aa35c6fbda541bce72b369b6ae AOSP/DeskClock - Add Kotlin files for TimerService, SetupView, Receiver Additionally, a small bug was fixed in the TimerModel and DataModel Kotlin code (found by new unit tests). Test: manual, ensuring the DeskClock UI is correct, also unit tests were run as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin -j $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: I82a4836ab55281a73168d35ea4f50d39279ce5da AOSP/DeskClock - Add Kotlin files for Timer classes Test: manual, ensuring the DeskClock UI and Timers function correctly, as well as unit tests, ran as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin -j $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: Idb33290c6bf11ee6147f547c85b5f6e3859c17b7 AOSP/DeskClock - Add Kotlin file for ExpiredTimersActivity Test: manual, tested the DeskClock UI including running timers to expiration. Also ran the unit tests as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: I93ec96bae36dc353c0c252c0ef6769965a7172e7 AOSP/DeskClock - Add Kotlin file for TimerFragment Test: manual, tested the DeskClock UI and Timers specifically. As well, unit tests were ran as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: Ib3769584161d6e712a8eafde977f58b3c55f69e3 AOSP/DeskClock - Add Kotlin for FormattedStringModel, PeriodicCallbackModel Test: manual - Tested the DeskClock UI. As well, unit tests were ran as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests BUG: 157255731 Original-Change-Id: I7cc4fb5aa20cd32be51e65de1b2b6a12a7cfa795 AOSP/DeskClock - Add Kotlin for Tab related UI Data files Test: manual - Tested the DeskClock UI and tab interactions. As well, unit tests were run as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ make DeskClockTests $ adb install out/target/product/sargo/testcases/DeskClockTests/arm64/DeskClockTests.apk $ adb shell am instrument -w com.android.deskclock.tests` BUG: 157255731 Original-Change-Id: Ibd7871edf20e548a1cd548246f0a6be88f5cfb88 AOSP/DeskClock - Add Kotlin file for CitySelectionActivity Test: manual - tested DeskClock UI. As well, tests were run as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ atest DeskClockTests BUG: 157255731 Original-Change-Id: I3bd0952f753130e655d1b9f3c911863f34e6e41a AOSP/DeskClock - Add Kotlin files for BaseActivity, CircleButtonsLayout Test: manual - Tested the DeskClock UI. As well, tests were run as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ atest DeskClockTests BUG: 157255731 Original-Change-Id: I019825f173305756633389a26a0bb0e973f2172c AOSP/DeskClock - Add Kotlin file for DeskClock class The onNewIntent call in TimerFragmentTest was changed to setIntent since the visibility of the protected onNewIntent method in Kotlin was more restrictive than before. Test: manual - Tested the DeskClock UI. As well tests were ran as follows $ source build/envsetup.sh $ lunch aosp_sargo-userdebug $ make DeskClockKotlin $ adb install out/target/product/sargo/product/app/DeskClockKotlin/DeskClockKotlin.apk $ atest DeskClockTests BUG: 157255731 Original-Change-Id: I9711dd8068a29fc0a25ee1f364ecb1b6ef326d6a Change-Id: I3d63f95cffc257734f803683d477bf3ecf88f208
2018-04-03Convert DeskClock to androidx.Aurimas Liutikas
Test: compile and open Bug: 76692459 Change-Id: Ibf8e95a917fbe3e364340ed1c5fba6e66f2d8afd
2017-01-31Establishing home timezone is now delayed as long as possibleJames Lemieux
Bug: 34846906 Test: SettingsDAOTest This grants more time for the setup wizard to be completed and to know that Clock is sampling the most appropriate time zone value from the underlying VM. Change-Id: I63757bc94e0cc984fa9bb7d9dc7f4bbd3e568379
2016-08-24Ensure city dates in widget update correctlyJustin Klaassen
Bug: 31026720 - Update widgets and day change callback whenever a TIME_SET occurs since that may have resulted in a day change for some cities. - Account for home clock timezone when scheduling day change callback. Test: Manually tested day change for MT home clock using SYD timezone. Change-Id: I896aec59fe3b89de7ad4384c7987c7535296e164
2016-06-17Use vector drawable for small alarm iconJames Lemieux
Bug: 25793040 Change-Id: Ida8530bfe621e296abde225c3f3b6b155bafceca
2016-05-09Fix update of next-alarm in widgets on KKJames Lemieux
An application broadcast is used to signal the update of the next alarm on KK. The corresponding intent filter was inadvertently removed from the manifest. Change-Id: I30659a42ed598ca803e716d690d116b9d45eec4e
2016-05-07Restore world cities list to digital clock widgetJames Lemieux
Bug: 28638735 Change-Id: Ia7dfe3bc6b64df2db4c2971a5dc9913a31a41b88
2016-04-25Set the 12/24 hour time formats in XML for digital widgetJames Lemieux
Bug: 28377696 This improves the user experience after a fresh reboot when the widget is shown on the screen but the provider has not yet sized and customized the widget layout. Change-Id: Ia7e192c0e8810f8f927aab5575a82cb03433c0ea
2016-04-11Compute optimal portrait/landscape fonts on each widget updateJames Lemieux
Bug: 27936490 Stop attempting to relayout the widgets in response to orientation changes. Start computing optimal sizing in both orientations on each widget relayout. This applies to both the digital widget and the city widgets. Change-Id: Ic120fb0d8073c717adef7cd177a2971c399af9d9
2016-04-11Tweak the layout algorithm for digital widgetJames Lemieux
Bug: 27282291 Changes in digital widget behavior: - 12-hour time display no longer includes am/pm to match lock screen - content is now centered within the bounds of the widget - content is capped at the same size as the lock screen and scaled down to fit in the bounds of the widget Change-Id: I32190222789524e326a699ac78fd51c9d80fbe9a
2016-04-06Introduce world city widgetJames Lemieux
Bug: 27282291 Bug: 27693716 Bug: 24126517 This CL includes: - full implementation of city widget - event logging for creation/deletion of widgets - tapping all widgets now opens the app in the prior state (not the clock tab) Change-Id: Ia43ec0ebf2f02aba6b7e277e5feca3e8afa91e64
2016-04-01Relayout widgets after launcher is rotatedJames Lemieux
It is quite difficult to detect an orientation change within the widget providers themselves, so the change is detected by the Application and the widgets are tickled to be updated. Other clean-up is also found in this change. Change-Id: Ia82c7e3b6a35ba54feedca28b340ebda2816276d
2016-03-14Fine tune clock icon fontJames Lemieux
Change-Id: Idbdf04c6a03bbb28df3a1c493ccf29f43fc87757
2016-03-14Overhaul the digital clock widgetJames Lemieux
Bug: 7346144 Bug: 26747882 Bug: 27391440 Bug: 27226990 Bug: 27282291 Bug: 18410094 Bug: 22124815 Bug: 27459689 Bug: 24003653 Bug: 27118501 The digital clock widget now scales to the size it is granted by the user. The scaling is accomplished by dynamically choosing a font size, and testing (through offscreen measurement) if the chosen font will successfully fit in the widget's allocated space. This technique should be successful across all locales, fonts and sizes. Note, as of this CL, digital clock widget no longer contains world cities. It only displays the current time, date, and next alarm time. Plans exist to create a new stand-alone widget for just the world cities. Change-Id: I2890f7a1aa8687218f1bbef485dc1154c65bde15
2016-02-05Adjust the formatting of date and next alarm timeJames Lemieux
Bug: 26014654 Bug: 26216446 The new chosen format matches the format displayed on the marshmallow lock screen. Specifically, old format resembled: Wed, February 3 ⏰ Thu 9:30 AM while the new format resembles: WED, FEB 3 ⏰ THU 9:30 AM This change can be seen in the following locations: - clock tab - digital clock widget - screensaver (invoked by long-pressing on clock tab) - daydream (configured via Settings -> Display -> Daydream) Change-Id: Ic86d5e85017940fdc809076425d326c8afcedd2b
2016-02-03Use Logger singleton for custom logtagsJustin Klaassen
Change-Id: I14098480f4092efbac67c458b774d9e648b80267
2015-12-16Support a variety of am/pm string sizes when formatting timesJames Lemieux
Bug: 26015206 Bug: 26014517 ag/786215 introduced a small regression which assumed that the meridiem (am/pm) portion of a time string should always be formatted at the same proportional size as the remainder of the time display. In truth, the user interface contains multiple ratios which were inadvertently coalesced to a single ratio. For example, the alarms tab formats alarm times with smaller am/pm strings than the rest of the application. The display of selected world clocks has been changed to share the same ratio with the alarms tab in this change. This change also enables the meridiem display on the digital widget. Change-Id: I351c816fd522aa32c445b85ac19f619e0a030a43
2015-12-11Avoid refreshing world clocks when none are selectedJames Lemieux
Bug: 26063240 DigitalAppWidgetProvider happily schedules callbacks with AlarmManager that occur every quarter hour. Those callbacks refresh the week day associated with every selected world clock every 15 minutes (see Nepal's timezone for why it is 15 minutes). This CL avoids scheduling a quarter hour callback in the common case: the user has not selected any world clocks for display. Change-Id: I7e4234d75e9301d000b5aac52c88c022061c348a
2015-10-21Make digital widget resizable to 2x1Dylan Phan
Bug: 24307555 Change-Id: If217226fd4f71c0c2ceb74732d8885cf4dc26ea6
2015-10-12Dynamically size fonts in the digital widgetDylan Phan
Bug: 22690473 Also introduced DataModel.run() for accessing data on the correct thread. Change-Id: I6c21b9293882e6aa502e6930bd039d342d9cbfd4
2015-08-28Remove unnecessary string.Fan Zhang
Bug: 23618281 Change-Id: I9ca8bdbc092e69ae193ba6e1a574bd6c9752ea0e
2015-08-17Refactor Cities (World Clocks) to use new unified DataModelJames Lemieux
This refactoring replaces CityObj with City, an immutable description of a city and its associated clock information. City objects are fetched via a DataModel class that is the single point of reference for all City data. This allows the data to be shared across the entire application. In particular, DigitalWidgetViewsFactory, ClockFragment and CitySelectionActivity all draw upon the same model to determine what cities exist, which ones are selected, and what the preferred display order shall be. Change-Id: I7c2eaa31b596b5333213415af58a7bb46ebb370e
2015-07-31Give up the dream of supporting pre-KitkatJames Lemieux
All SDK version checks are now routed through readable cover methods on Utils. All code paths handling SDK versions that predate Kitkat have been removed. Change-Id: I876620ad34ab3d701789cb35904ccfe03c2d1e45
2015-07-08Refer to Build.VERSION.MNC to check for M platformJames Lemieux
Change-Id: Ifdd61667c6046d3c007ba7ffd62bdf70eb373a43
2015-03-09DateFormat: Do not use .getBestDateTimePattern() for pre-18Annie Chin
Instead, add new format strings for 12 and 24 hour times, with and without weekdays. Change-Id: I282b2d6d2e3ac2fbff94986217292f90ccbc2fb3 Bugs: 19621195
2015-02-02Add a broadcast intent so pre-L AppWidgets can see "nextalarm" changes.Annie Chin
Bug: 19200823 Change-Id: I19b53ef240e3a0175fd00c8525def087811f42ab
2014-07-14Migrate DeskClock to AlarmManager.setAlarmClockAdrian Roos
Updates AlarmNotifications to set alarm info via the new AlarmManager API. Bug: 14589952 Change-Id: I50099a8b6241b32afedbd32c034c4c7ac19373b0
2013-10-10Use best time formatting for widgetIsaac Katzenelson
Bug: 11119295 Change-Id: I7d463eb5d4ab7268fdfdfc38613042a45dd901e6
2013-10-08Update SDK version checkIsaac Katzenelson
Bug: 10732543 Change-Id: I5141cee374778888f6b27ea9726ccdee0daca7cd
2013-09-26Fix date layout in widgetIsaac Katzenelson
Bug: 10823373 Change-Id: I347d2c346e41e666b1601240e7ee647fecb86d50
2013-09-19DigitalAppWidgetProvider is receiver for actionsRobyn Coultas
Bug: 8239532 Bug: 10695465 DigitalWidgetViewsFactory lifespan was not unlimited, so using it to receive actions was inappropriate. Moved all handling into DigitalAppWidgetProvider. This change lost some of the optimizations that DigitalWidgetViewsFactory had. Replaced previous Utils.ACTION_ON_QUARTER_HOUR users with code that uses postDelayed Change-Id: I27a7b96f8ab85f8f72c7e1b75d55a9616c3db859
2013-08-16Added a log to report registration removalRobyn Coultas
Bug: 8239532 Stopped updating context on every broadcast reception Made some code reduction - sharing code in DigitalWidgetViewsFactory Replaced intent literal strings with the constants Fixed a deprecated reference Added some commentary Renamed some variables to improve clarity Cleaned up the lint warnings Change-Id: Icb38fcdec2104a271bc429b74430e7ff371d4098
2012-12-12Do not launch clock when touching the clock on the lockscreenIsaac Katzenelson
Bug: 7640566 On the lock screen: Do not launch clock at all, launch CitiesActivity when clicking on the world clock. On the home screen: Launch the clock app when touching the clock, launch CitiesActivity when clicking on the world clock. Change-Id: I09302f35c7c585bfd1db010eb3f14feea84e34af
2012-11-09Fixed flicker in widgetIsaac Katzenelson
Bug: 7514059 Adding the Action_ON_SCREEN to the broadcast receiver , refreshed the world clock list which cause the flicker. Changed to update only the next alarm. Change-Id: I2330aa70d34c026f69c9b02c35976d6e2a0fb0ac
2012-11-09Use the new TextClock widget for the appwidget's date.Daniel Sandler
Bug: 7510508 Change-Id: I3b18d98fbc4af0e8454693c3fdc89f7c47dbfe9c
2012-11-06Add am/pm support and bold hours to widgetIsaac Katzenelson
Bug: 7488870, 7476938 Added am/pm support for world clock Split the TextClock into 2 clocks: hours with bold digits and minutes with thin digits Added click feedback to main clock. Change-Id: I1838bc0ae90d18845346336dcb0bb2d8f3521fdf
2012-11-06Fix widget layoutsIsaac Katzenelson
Bug: 7469622, 7482384 Fixed layouts and set a minimum height for showing the world clock list to avoid a list with only one cut off item. Fixed 12h/24h settings. Change-Id: Ie8a195de93c8bcda61e5a07415852a3e5e91faf3
2012-11-05Clock widget fixes:Itzhak Katzenelson
Bug 7476882 - Switched to TextClock widgets to get faster time updates after screen is on. Bug 7457071 - Changed layouts to make date and next alarm visible. Change-Id: I3552cba1dfc7bbb4df9ff5c140518b7dd69ce573
2012-11-02Fix crash on widgetIsaac Katzenelson
Bug: 7467875 Fixed bug where not testing if nextAlarm sting is a null. This may happen in multiple users configuration. Change-Id: I691c58b61e3489535133e458a56e74b8df4ad76d
2012-10-30Add support for keyguardIsaac Katzenelson
Bug: 7390795 Added support for keyguard. Right now, the widget gets the size callback with zeros as sizes. Put a workaround for it. Change-Id: I531e12e324341e94545f8ff1ef5d9ab927ac3f3c
2012-10-30New digital clock widget for ClockIsaac Katzenelson
Bug: 7390795 Added a new widget with its own provider and service and factory. Factory extends a broadcast receiver and listens to all time changes, locale changes, changes in world clock and alarms. Added broadcasts for changing the world clock's user cities list and for setting the next alarm. Change-Id: Ida4bbd619da941fb46505cb2ac653fde0a41a97f