Loading core/java/android/app/timezonedetector/TimeZoneDetector.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,13 @@ public interface TimeZoneDetector { */ */ String SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED = "set_auto_detection_enabled"; String SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED = "set_auto_detection_enabled"; /** * A shell command that prints whether the telephony-based time zone detection feature is * supported on the device. * @hide */ String SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED = "is_telephony_detection_supported"; /** /** * A shell command that prints whether the geolocation-based time zone detection feature is * A shell command that prints whether the geolocation-based time zone detection feature is * supported on the device. * supported on the device. Loading services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,13 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub mHandler.post(() -> mTimeZoneDetectorStrategy.suggestTelephonyTimeZone(timeZoneSuggestion)); mHandler.post(() -> mTimeZoneDetectorStrategy.suggestTelephonyTimeZone(timeZoneSuggestion)); } } boolean isTelephonyTimeZoneDetectionSupported() { enforceManageTimeZoneDetectorPermission(); return ServiceConfigAccessor.getInstance(mContext) .isTelephonyTimeZoneDetectionFeatureSupported(); } boolean isGeoTimeZoneDetectionSupported() { boolean isGeoTimeZoneDetectionSupported() { enforceManageTimeZoneDetectorPermission(); enforceManageTimeZoneDetectorPermission(); Loading services/core/java/com/android/server/timezonedetector/TimeZoneDetectorShellCommand.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.timezonedetector; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SERVICE_NAME; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SERVICE_NAME; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_GEO_DETECTION_ENABLED; Loading Loading @@ -61,6 +62,8 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return runIsAutoDetectionEnabled(); return runIsAutoDetectionEnabled(); case SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED: case SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED: return runSetAutoDetectionEnabled(); return runSetAutoDetectionEnabled(); case SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED: return runIsTelephonyDetectionSupported(); case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: return runIsGeoDetectionSupported(); return runIsGeoDetectionSupported(); case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: Loading Loading @@ -89,6 +92,13 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return 0; return 0; } } private int runIsTelephonyDetectionSupported() { final PrintWriter pw = getOutPrintWriter(); boolean enabled = mInterface.isTelephonyTimeZoneDetectionSupported(); pw.println(enabled); return 0; } private int runIsGeoDetectionSupported() { private int runIsGeoDetectionSupported() { final PrintWriter pw = getOutPrintWriter(); final PrintWriter pw = getOutPrintWriter(); boolean enabled = mInterface.isGeoTimeZoneDetectionSupported(); boolean enabled = mInterface.isGeoTimeZoneDetectionSupported(); Loading Loading @@ -169,6 +179,9 @@ class TimeZoneDetectorShellCommand extends ShellCommand { pw.printf(" Prints true/false according to the automatic time zone detection setting\n"); pw.printf(" Prints true/false according to the automatic time zone detection setting\n"); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED); pw.printf(" Sets the automatic time zone detection setting.\n"); pw.printf(" Sets the automatic time zone detection setting.\n"); pw.printf(" %s\n", SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED); pw.printf(" Prints true/false according to whether telephony time zone detection is" + " supported on this device.\n"); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.printf(" Prints true/false according to whether geolocation time zone detection is" pw.printf(" Prints true/false according to whether geolocation time zone detection is" + " supported on this device.\n"); + " supported on this device.\n"); Loading Loading
core/java/android/app/timezonedetector/TimeZoneDetector.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -47,6 +47,13 @@ public interface TimeZoneDetector { */ */ String SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED = "set_auto_detection_enabled"; String SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED = "set_auto_detection_enabled"; /** * A shell command that prints whether the telephony-based time zone detection feature is * supported on the device. * @hide */ String SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED = "is_telephony_detection_supported"; /** /** * A shell command that prints whether the geolocation-based time zone detection feature is * A shell command that prints whether the geolocation-based time zone detection feature is * supported on the device. * supported on the device. Loading
services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,13 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub mHandler.post(() -> mTimeZoneDetectorStrategy.suggestTelephonyTimeZone(timeZoneSuggestion)); mHandler.post(() -> mTimeZoneDetectorStrategy.suggestTelephonyTimeZone(timeZoneSuggestion)); } } boolean isTelephonyTimeZoneDetectionSupported() { enforceManageTimeZoneDetectorPermission(); return ServiceConfigAccessor.getInstance(mContext) .isTelephonyTimeZoneDetectionFeatureSupported(); } boolean isGeoTimeZoneDetectionSupported() { boolean isGeoTimeZoneDetectionSupported() { enforceManageTimeZoneDetectorPermission(); enforceManageTimeZoneDetectorPermission(); Loading
services/core/java/com/android/server/timezonedetector/TimeZoneDetectorShellCommand.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.timezonedetector; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SERVICE_NAME; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SERVICE_NAME; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_SET_GEO_DETECTION_ENABLED; Loading Loading @@ -61,6 +62,8 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return runIsAutoDetectionEnabled(); return runIsAutoDetectionEnabled(); case SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED: case SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED: return runSetAutoDetectionEnabled(); return runSetAutoDetectionEnabled(); case SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED: return runIsTelephonyDetectionSupported(); case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: return runIsGeoDetectionSupported(); return runIsGeoDetectionSupported(); case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: Loading Loading @@ -89,6 +92,13 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return 0; return 0; } } private int runIsTelephonyDetectionSupported() { final PrintWriter pw = getOutPrintWriter(); boolean enabled = mInterface.isTelephonyTimeZoneDetectionSupported(); pw.println(enabled); return 0; } private int runIsGeoDetectionSupported() { private int runIsGeoDetectionSupported() { final PrintWriter pw = getOutPrintWriter(); final PrintWriter pw = getOutPrintWriter(); boolean enabled = mInterface.isGeoTimeZoneDetectionSupported(); boolean enabled = mInterface.isGeoTimeZoneDetectionSupported(); Loading Loading @@ -169,6 +179,9 @@ class TimeZoneDetectorShellCommand extends ShellCommand { pw.printf(" Prints true/false according to the automatic time zone detection setting\n"); pw.printf(" Prints true/false according to the automatic time zone detection setting\n"); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_AUTO_DETECTION_ENABLED); pw.printf(" Sets the automatic time zone detection setting.\n"); pw.printf(" Sets the automatic time zone detection setting.\n"); pw.printf(" %s\n", SHELL_COMMAND_IS_TELEPHONY_DETECTION_SUPPORTED); pw.printf(" Prints true/false according to whether telephony time zone detection is" + " supported on this device.\n"); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.printf(" Prints true/false according to whether geolocation time zone detection is" pw.printf(" Prints true/false according to whether geolocation time zone detection is" + " supported on this device.\n"); + " supported on this device.\n"); Loading