Loading core/java/android/app/timezonedetector/TimeZoneDetector.java +0 −6 Original line number Diff line number Diff line Loading @@ -54,12 +54,6 @@ public interface TimeZoneDetector { */ String SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED = "is_geo_detection_supported"; /** * A shell command that prints the current user's "location enabled" setting. * @hide */ String SHELL_COMMAND_IS_LOCATION_ENABLED = "is_location_enabled"; /** * A shell command that prints the current user's "location-based time zone detection enabled" * setting. Loading services/core/java/com/android/server/location/LocationShellCommand.java +8 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ class LocationShellCommand extends BasicShellCommandHandler { } switch (cmd) { case "is-location-enabled": { int userId = parseUserId(); boolean enabled = mService.isLocationEnabledForUser(userId); getOutPrintWriter().println(enabled); return 0; } case "set-location-enabled": { int userId = parseUserId(); boolean enabled = Boolean.parseBoolean(getNextArgRequired()); Loading Loading @@ -238,6 +244,8 @@ class LocationShellCommand extends BasicShellCommandHandler { pw.println("Location service commands:"); pw.println(" help or -h"); pw.println(" Print this help text."); pw.println(" is-location-enabled [--user <USER_ID>]"); pw.println(" Gets the master location switch enabled state."); pw.println(" set-location-enabled [--user <USER_ID>] true|false"); pw.println(" Sets the master location switch enabled state."); pw.println(" providers"); Loading services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +0 −15 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.app.timezonedetector.ITimeZoneDetectorService; import android.app.timezonedetector.ManualTimeZoneSuggestion; import android.app.timezonedetector.TelephonyTimeZoneSuggestion; import android.content.Context; import android.location.LocationManager; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -35,7 +34,6 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ShellCallback; import android.os.SystemProperties; import android.os.UserHandle; import android.util.ArrayMap; import android.util.IndentingPrintWriter; import android.util.Slog; Loading Loading @@ -335,19 +333,6 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub return isGeoLocationTimeZoneDetectionEnabled(mContext); } boolean isLocationEnabled(@UserIdInt int userId) { enforceManageTimeZoneDetectorPermission(); final long token = mCallerIdentityInjector.clearCallingIdentity(); try { UserHandle user = UserHandle.of(userId); LocationManager locationManager = mContext.getSystemService(LocationManager.class); return locationManager.isLocationEnabledForUser(user); } finally { mCallerIdentityInjector.restoreCallingIdentity(token); } } @Override protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @Nullable String[] args) { Loading services/core/java/com/android/server/timezonedetector/TimeZoneDetectorShellCommand.java +0 −14 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ 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_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_LOCATION_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_SUGGEST_GEO_LOCATION_TIME_ZONE; Loading Loading @@ -57,8 +56,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return runSetAutoDetectionEnabled(); case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: return runIsGeoDetectionSupported(); case SHELL_COMMAND_IS_LOCATION_ENABLED: return runIsLocationEnabled(); case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: return runIsGeoDetectionEnabled(); case SHELL_COMMAND_SET_GEO_DETECTION_ENABLED: Loading Loading @@ -92,14 +89,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return 0; } private int runIsLocationEnabled() { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_CURRENT; boolean enabled = mInterface.isLocationEnabled(userId); pw.println(enabled); return 0; } private int runIsGeoDetectionEnabled() { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_CURRENT; Loading Loading @@ -176,9 +165,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.println(" Prints true/false according to whether geolocation time zone detection is" + " supported on this device"); pw.printf(" %s\n", SHELL_COMMAND_IS_LOCATION_ENABLED); pw.println(" Prints true/false according to whether the master location toggle is" + " enabled for the current user"); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_ENABLED); pw.println(" Prints true/false according to the geolocation tz detection setting"); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_GEO_DETECTION_ENABLED); Loading Loading
core/java/android/app/timezonedetector/TimeZoneDetector.java +0 −6 Original line number Diff line number Diff line Loading @@ -54,12 +54,6 @@ public interface TimeZoneDetector { */ String SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED = "is_geo_detection_supported"; /** * A shell command that prints the current user's "location enabled" setting. * @hide */ String SHELL_COMMAND_IS_LOCATION_ENABLED = "is_location_enabled"; /** * A shell command that prints the current user's "location-based time zone detection enabled" * setting. Loading
services/core/java/com/android/server/location/LocationShellCommand.java +8 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,12 @@ class LocationShellCommand extends BasicShellCommandHandler { } switch (cmd) { case "is-location-enabled": { int userId = parseUserId(); boolean enabled = mService.isLocationEnabledForUser(userId); getOutPrintWriter().println(enabled); return 0; } case "set-location-enabled": { int userId = parseUserId(); boolean enabled = Boolean.parseBoolean(getNextArgRequired()); Loading Loading @@ -238,6 +244,8 @@ class LocationShellCommand extends BasicShellCommandHandler { pw.println("Location service commands:"); pw.println(" help or -h"); pw.println(" Print this help text."); pw.println(" is-location-enabled [--user <USER_ID>]"); pw.println(" Gets the master location switch enabled state."); pw.println(" set-location-enabled [--user <USER_ID>] true|false"); pw.println(" Sets the master location switch enabled state."); pw.println(" providers"); Loading
services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +0 −15 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.app.timezonedetector.ITimeZoneDetectorService; import android.app.timezonedetector.ManualTimeZoneSuggestion; import android.app.timezonedetector.TelephonyTimeZoneSuggestion; import android.content.Context; import android.location.LocationManager; import android.os.Binder; import android.os.Handler; import android.os.IBinder; Loading @@ -35,7 +34,6 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ShellCallback; import android.os.SystemProperties; import android.os.UserHandle; import android.util.ArrayMap; import android.util.IndentingPrintWriter; import android.util.Slog; Loading Loading @@ -335,19 +333,6 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub return isGeoLocationTimeZoneDetectionEnabled(mContext); } boolean isLocationEnabled(@UserIdInt int userId) { enforceManageTimeZoneDetectorPermission(); final long token = mCallerIdentityInjector.clearCallingIdentity(); try { UserHandle user = UserHandle.of(userId); LocationManager locationManager = mContext.getSystemService(LocationManager.class); return locationManager.isLocationEnabledForUser(user); } finally { mCallerIdentityInjector.restoreCallingIdentity(token); } } @Override protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @Nullable String[] args) { Loading
services/core/java/com/android/server/timezonedetector/TimeZoneDetectorShellCommand.java +0 −14 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ 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_GEO_DETECTION_ENABLED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED; import static android.app.timezonedetector.TimeZoneDetector.SHELL_COMMAND_IS_LOCATION_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_SUGGEST_GEO_LOCATION_TIME_ZONE; Loading Loading @@ -57,8 +56,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return runSetAutoDetectionEnabled(); case SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED: return runIsGeoDetectionSupported(); case SHELL_COMMAND_IS_LOCATION_ENABLED: return runIsLocationEnabled(); case SHELL_COMMAND_IS_GEO_DETECTION_ENABLED: return runIsGeoDetectionEnabled(); case SHELL_COMMAND_SET_GEO_DETECTION_ENABLED: Loading Loading @@ -92,14 +89,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { return 0; } private int runIsLocationEnabled() { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_CURRENT; boolean enabled = mInterface.isLocationEnabled(userId); pw.println(enabled); return 0; } private int runIsGeoDetectionEnabled() { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_CURRENT; Loading Loading @@ -176,9 +165,6 @@ class TimeZoneDetectorShellCommand extends ShellCommand { pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_SUPPORTED); pw.println(" Prints true/false according to whether geolocation time zone detection is" + " supported on this device"); pw.printf(" %s\n", SHELL_COMMAND_IS_LOCATION_ENABLED); pw.println(" Prints true/false according to whether the master location toggle is" + " enabled for the current user"); pw.printf(" %s\n", SHELL_COMMAND_IS_GEO_DETECTION_ENABLED); pw.println(" Prints true/false according to the geolocation tz detection setting"); pw.printf(" %s true|false\n", SHELL_COMMAND_SET_GEO_DETECTION_ENABLED); Loading