Merge "Renames / tidy ups"
This commit is contained in:
@@ -29,7 +29,7 @@ import android.content.Context;
|
||||
@SystemService(Context.TIME_ZONE_DETECTOR_SERVICE)
|
||||
public interface TimeZoneDetector {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the current user's time zone capabilities. See {@link TimeZoneCapabilities}.
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS)
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.database.ContentObserver;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.DumpUtils;
|
||||
@@ -139,7 +140,9 @@ public final class TimeDetectorService extends ITimeDetectorService.Stub {
|
||||
@Nullable String[] args) {
|
||||
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
|
||||
|
||||
mTimeDetectorStrategy.dump(pw, args);
|
||||
IndentingPrintWriter ipw = new IndentingPrintWriter(pw);
|
||||
mTimeDetectorStrategy.dump(ipw, args);
|
||||
ipw.flush();
|
||||
}
|
||||
|
||||
private void enforceSuggestTelephonyTimePermission() {
|
||||
|
||||
@@ -17,25 +17,25 @@
|
||||
package com.android.server.timedetector;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.timedetector.ManualTimeSuggestion;
|
||||
import android.app.timedetector.NetworkTimeSuggestion;
|
||||
import android.app.timedetector.TelephonyTimeSuggestion;
|
||||
import android.os.TimestampedValue;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import com.android.server.timezonedetector.Dumpable;
|
||||
|
||||
/**
|
||||
* The interface for the class that implements the time detection algorithm used by the
|
||||
* {@link TimeDetectorService}.
|
||||
*
|
||||
* <p>Most calls will be handled by a single thread but that is not true for all calls. For example
|
||||
* {@link #dump(PrintWriter, String[])}) may be called on a different thread so implementations must
|
||||
* handle thread safety.
|
||||
* {@link #dump(IndentingPrintWriter, String[])}) may be called on a different thread so
|
||||
* implementations must handle thread safety.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface TimeDetectorStrategy {
|
||||
public interface TimeDetectorStrategy extends Dumpable {
|
||||
|
||||
/**
|
||||
* The interface used by the strategy to interact with the surrounding service.
|
||||
@@ -94,9 +94,6 @@ public interface TimeDetectorStrategy {
|
||||
/** Handle the auto-time setting being toggled on or off. */
|
||||
void handleAutoTimeDetectionChanged();
|
||||
|
||||
/** Dump debug information. */
|
||||
void dump(@NonNull PrintWriter pw, @Nullable String[] args);
|
||||
|
||||
// Utility methods below are to be moved to a better home when one becomes more obvious.
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,16 +24,15 @@ import android.app.timedetector.ManualTimeSuggestion;
|
||||
import android.app.timedetector.NetworkTimeSuggestion;
|
||||
import android.app.timedetector.TelephonyTimeSuggestion;
|
||||
import android.os.TimestampedValue;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.LocalLog;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.server.timezonedetector.ArrayMapWithHistory;
|
||||
import com.android.server.timezonedetector.ReferenceWithHistory;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@@ -203,8 +202,7 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void dump(@NonNull PrintWriter pw, @Nullable String[] args) {
|
||||
IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ");
|
||||
public synchronized void dump(@NonNull IndentingPrintWriter ipw, @Nullable String[] args) {
|
||||
ipw.println("TimeDetectorStrategy:");
|
||||
ipw.increaseIndent(); // level 1
|
||||
|
||||
@@ -232,7 +230,6 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
|
||||
ipw.decreaseIndent(); // level 2
|
||||
|
||||
ipw.decreaseIndent(); // level 1
|
||||
ipw.flush();
|
||||
}
|
||||
|
||||
@GuardedBy("this")
|
||||
|
||||
@@ -20,10 +20,10 @@ import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
|
||||
/**
|
||||
* A partial decorator for {@link ArrayMap} that records historic values for each mapping for
|
||||
|
||||
@@ -15,24 +15,27 @@
|
||||
*/
|
||||
package com.android.server.timezonedetector;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
/** An interface for components that can write their internal state to dumpsys logs. */
|
||||
public interface Dumpable {
|
||||
|
||||
/** Dump internal state. */
|
||||
void dump(PrintWriter pw, String[] args);
|
||||
void dump(@NonNull IndentingPrintWriter pw, @Nullable String[] args);
|
||||
|
||||
/**
|
||||
* An interface that can be used expose when one component allows another to be registered so
|
||||
* that it is dumped at the same time.
|
||||
*/
|
||||
interface Dumpee {
|
||||
interface Container {
|
||||
|
||||
/**
|
||||
* Registers the supplied {@link Dumpable}. When the implementation is dumped
|
||||
* {@link Dumpable#dump(PrintWriter, String[])} should be called on the {@code dumpable}.
|
||||
* {@link Dumpable#dump(IndentingPrintWriter, String[])} should be called on the
|
||||
* {@code dumpable}.
|
||||
*/
|
||||
void addDumpable(Dumpable dumpable);
|
||||
void addDumpable(@NonNull Dumpable dumpable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ package com.android.server.timezonedetector;
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.annotation.NonNull;
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface TimeZoneDetectorInternal extends Dumpable.Dumpee {
|
||||
public interface TimeZoneDetectorInternal extends Dumpable.Container {
|
||||
|
||||
/**
|
||||
* Suggests the current time zone, determined using geolocation, to the detector. The
|
||||
|
||||
@@ -49,7 +49,7 @@ public final class TimeZoneDetectorInternalImpl implements TimeZoneDetectorInter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDumpable(Dumpable dumpable) {
|
||||
public void addDumpable(@NonNull Dumpable dumpable) {
|
||||
mTimeZoneDetectorStrategy.addDumpable(dumpable);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.os.ResultReceiver;
|
||||
import android.os.ShellCallback;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
@@ -118,7 +119,7 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub
|
||||
Settings.Global.getUriFor(Settings.Global.AUTO_TIME_ZONE), true,
|
||||
new ContentObserver(handler) {
|
||||
public void onChange(boolean selfChange) {
|
||||
service.handleAutoTimeZoneDetectionChanged();
|
||||
service.handleAutoTimeZoneConfigChanged();
|
||||
}
|
||||
});
|
||||
return service;
|
||||
@@ -272,12 +273,14 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub
|
||||
@Nullable String[] args) {
|
||||
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
|
||||
|
||||
mTimeZoneDetectorStrategy.dump(pw, args);
|
||||
IndentingPrintWriter ipw = new IndentingPrintWriter(pw);
|
||||
mTimeZoneDetectorStrategy.dump(ipw, args);
|
||||
ipw.flush();
|
||||
}
|
||||
|
||||
/** Internal method for handling the auto time zone configuration being changed. */
|
||||
@VisibleForTesting
|
||||
public void handleAutoTimeZoneDetectionChanged() {
|
||||
public void handleAutoTimeZoneConfigChanged() {
|
||||
mHandler.post(mTimeZoneDetectorStrategy::handleAutoTimeZoneConfigChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ import android.app.timezonedetector.ManualTimeZoneSuggestion;
|
||||
import android.app.timezonedetector.TelephonyTimeZoneSuggestion;
|
||||
import android.app.timezonedetector.TimeZoneCapabilities;
|
||||
import android.app.timezonedetector.TimeZoneConfiguration;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
/**
|
||||
* The interface for the class that implements the time detection algorithm used by the
|
||||
@@ -32,12 +31,12 @@ import java.io.PrintWriter;
|
||||
* and what to set it to.
|
||||
*
|
||||
* <p>Most calls will be handled by a single thread but that is not true for all calls. For example
|
||||
* {@link #dump(PrintWriter, String[])}) may be called on a different thread so implementations must
|
||||
* handle thread safety.
|
||||
* {@link #dump(IndentingPrintWriter, String[])}) may be called on a different thread so
|
||||
* implementations mustvhandle thread safety.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public interface TimeZoneDetectorStrategy extends Dumpable.Dumpee {
|
||||
public interface TimeZoneDetectorStrategy extends Dumpable, Dumpable.Container {
|
||||
|
||||
/** A listener for strategy events. */
|
||||
interface StrategyListener {
|
||||
@@ -91,9 +90,4 @@ public interface TimeZoneDetectorStrategy extends Dumpable.Dumpee {
|
||||
* Called when there has been a change to the automatic time zone detection configuration.
|
||||
*/
|
||||
void handleAutoTimeZoneConfigChanged();
|
||||
|
||||
/**
|
||||
* Dumps internal state such as field values.
|
||||
*/
|
||||
void dump(PrintWriter pw, String[] args);
|
||||
}
|
||||
|
||||
@@ -32,14 +32,13 @@ import android.app.timezonedetector.TelephonyTimeZoneSuggestion;
|
||||
import android.app.timezonedetector.TimeZoneCapabilities;
|
||||
import android.app.timezonedetector.TimeZoneConfiguration;
|
||||
import android.content.Context;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.LocalLog;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -517,7 +516,7 @@ public final class TimeZoneDetectorStrategyImpl implements TimeZoneDetectorStrat
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void addDumpable(Dumpable dumpable) {
|
||||
public synchronized void addDumpable(@NonNull Dumpable dumpable) {
|
||||
mDumpables.add(dumpable);
|
||||
}
|
||||
|
||||
@@ -525,8 +524,7 @@ public final class TimeZoneDetectorStrategyImpl implements TimeZoneDetectorStrat
|
||||
* Dumps internal state such as field values.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dump(PrintWriter pw, String[] args) {
|
||||
IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ");
|
||||
public synchronized void dump(@NonNull IndentingPrintWriter ipw, @Nullable String[] args) {
|
||||
ipw.println("TimeZoneDetectorStrategy:");
|
||||
|
||||
ipw.increaseIndent(); // level 1
|
||||
@@ -549,7 +547,6 @@ public final class TimeZoneDetectorStrategyImpl implements TimeZoneDetectorStrat
|
||||
for (Dumpable dumpable : mDumpables) {
|
||||
dumpable.dump(ipw, args);
|
||||
}
|
||||
ipw.flush();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.TimestampedValue;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
@@ -46,6 +47,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TimeDetectorServiceTest {
|
||||
@@ -177,7 +179,8 @@ public class TimeDetectorServiceTest {
|
||||
when(mMockContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP))
|
||||
.thenReturn(PackageManager.PERMISSION_GRANTED);
|
||||
|
||||
mTimeDetectorService.dump(null, null, null);
|
||||
PrintWriter pw = new PrintWriter(new StringWriter());
|
||||
mTimeDetectorService.dump(null, pw, null);
|
||||
|
||||
verify(mMockContext).checkCallingOrSelfPermission(eq(android.Manifest.permission.DUMP));
|
||||
mStubbedTimeDetectorStrategy.verifyDumpCalled();
|
||||
@@ -251,7 +254,7 @@ public class TimeDetectorServiceTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(IndentingPrintWriter pw, String[] args) {
|
||||
mDumpCalled = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,9 @@ import android.app.timezonedetector.ManualTimeZoneSuggestion;
|
||||
import android.app.timezonedetector.TelephonyTimeZoneSuggestion;
|
||||
import android.app.timezonedetector.TimeZoneCapabilities;
|
||||
import android.app.timezonedetector.TimeZoneConfiguration;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
class StubbedTimeZoneDetectorStrategy implements TimeZoneDetectorStrategy {
|
||||
class FakeTimeZoneDetectorStrategy implements TimeZoneDetectorStrategy {
|
||||
|
||||
private StrategyListener mListener;
|
||||
|
||||
@@ -110,7 +109,7 @@ class StubbedTimeZoneDetectorStrategy implements TimeZoneDetectorStrategy {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(IndentingPrintWriter pw, String[] args) {
|
||||
mDumpCalled = true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TimeZoneDetectorInternalImplTest {
|
||||
private static final List<String> ARBITRARY_ZONE_IDS = Arrays.asList("TestZoneId");
|
||||
|
||||
private Context mMockContext;
|
||||
private StubbedTimeZoneDetectorStrategy mStubbedTimeZoneDetectorStrategy;
|
||||
private FakeTimeZoneDetectorStrategy mFakeTimeZoneDetectorStrategy;
|
||||
|
||||
private TimeZoneDetectorInternalImpl mTimeZoneDetectorInternal;
|
||||
private HandlerThread mHandlerThread;
|
||||
@@ -53,10 +53,10 @@ public class TimeZoneDetectorInternalImplTest {
|
||||
mHandlerThread.start();
|
||||
mTestHandler = new TestHandler(mHandlerThread.getLooper());
|
||||
|
||||
mStubbedTimeZoneDetectorStrategy = new StubbedTimeZoneDetectorStrategy();
|
||||
mFakeTimeZoneDetectorStrategy = new FakeTimeZoneDetectorStrategy();
|
||||
|
||||
mTimeZoneDetectorInternal = new TimeZoneDetectorInternalImpl(
|
||||
mMockContext, mTestHandler, mStubbedTimeZoneDetectorStrategy);
|
||||
mMockContext, mTestHandler, mFakeTimeZoneDetectorStrategy);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -72,7 +72,7 @@ public class TimeZoneDetectorInternalImplTest {
|
||||
mTestHandler.assertTotalMessagesEnqueued(1);
|
||||
|
||||
mTestHandler.waitForMessagesToBeProcessed();
|
||||
mStubbedTimeZoneDetectorStrategy.verifySuggestGeolocationTimeZoneCalled(timeZoneSuggestion);
|
||||
mFakeTimeZoneDetectorStrategy.verifySuggestGeolocationTimeZoneCalled(timeZoneSuggestion);
|
||||
}
|
||||
|
||||
private static GeolocationTimeZoneSuggestion createGeolocationTimeZoneSuggestion() {
|
||||
|
||||
@@ -46,13 +46,16 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class TimeZoneDetectorServiceTest {
|
||||
|
||||
private static final int ARBITRARY_USER_ID = 9999;
|
||||
|
||||
private Context mMockContext;
|
||||
private StubbedTimeZoneDetectorStrategy mStubbedTimeZoneDetectorStrategy;
|
||||
private FakeTimeZoneDetectorStrategy mFakeTimeZoneDetectorStrategy;
|
||||
|
||||
private TimeZoneDetectorService mTimeZoneDetectorService;
|
||||
private HandlerThread mHandlerThread;
|
||||
@@ -68,10 +71,10 @@ public class TimeZoneDetectorServiceTest {
|
||||
mHandlerThread.start();
|
||||
mTestHandler = new TestHandler(mHandlerThread.getLooper());
|
||||
|
||||
mStubbedTimeZoneDetectorStrategy = new StubbedTimeZoneDetectorStrategy();
|
||||
mFakeTimeZoneDetectorStrategy = new FakeTimeZoneDetectorStrategy();
|
||||
|
||||
mTimeZoneDetectorService = new TimeZoneDetectorService(
|
||||
mMockContext, mTestHandler, mStubbedTimeZoneDetectorStrategy);
|
||||
mMockContext, mTestHandler, mFakeTimeZoneDetectorStrategy);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -100,7 +103,7 @@ public class TimeZoneDetectorServiceTest {
|
||||
doNothing().when(mMockContext).enforceCallingPermission(anyString(), any());
|
||||
|
||||
TimeZoneCapabilities capabilities = createTimeZoneCapabilities();
|
||||
mStubbedTimeZoneDetectorStrategy.initializeCapabilities(capabilities);
|
||||
mFakeTimeZoneDetectorStrategy.initializeCapabilities(capabilities);
|
||||
|
||||
assertEquals(capabilities, mTimeZoneDetectorService.getCapabilities());
|
||||
|
||||
@@ -130,7 +133,7 @@ public class TimeZoneDetectorServiceTest {
|
||||
|
||||
TimeZoneConfiguration configuration =
|
||||
createTimeZoneConfiguration(false /* autoDetectionEnabled */);
|
||||
mStubbedTimeZoneDetectorStrategy.initializeConfiguration(configuration);
|
||||
mFakeTimeZoneDetectorStrategy.initializeConfiguration(configuration);
|
||||
|
||||
assertEquals(configuration, mTimeZoneDetectorService.getConfiguration());
|
||||
|
||||
@@ -161,7 +164,8 @@ public class TimeZoneDetectorServiceTest {
|
||||
|
||||
TimeZoneConfiguration autoDetectDisabledConfiguration =
|
||||
createTimeZoneConfiguration(false /* autoDetectionEnabled */);
|
||||
mStubbedTimeZoneDetectorStrategy.initializeConfiguration(autoDetectDisabledConfiguration);
|
||||
|
||||
mFakeTimeZoneDetectorStrategy.initializeConfiguration(autoDetectDisabledConfiguration);
|
||||
|
||||
IBinder mockListenerBinder = mock(IBinder.class);
|
||||
ITimeZoneConfigurationListener mockListener = mock(ITimeZoneConfigurationListener.class);
|
||||
@@ -177,7 +181,7 @@ public class TimeZoneDetectorServiceTest {
|
||||
// Simulate the configuration being changed and verify the mockListener was notified.
|
||||
TimeZoneConfiguration autoDetectEnabledConfiguration =
|
||||
createTimeZoneConfiguration(true /* autoDetectionEnabled */);
|
||||
mStubbedTimeZoneDetectorStrategy.updateConfiguration(
|
||||
mFakeTimeZoneDetectorStrategy.updateConfiguration(
|
||||
ARBITRARY_USER_ID, autoDetectEnabledConfiguration);
|
||||
|
||||
verify(mockListener).onChange(autoDetectEnabledConfiguration);
|
||||
@@ -209,7 +213,7 @@ public class TimeZoneDetectorServiceTest {
|
||||
assertEquals(expectedResult,
|
||||
mTimeZoneDetectorService.suggestManualTimeZone(timeZoneSuggestion));
|
||||
|
||||
mStubbedTimeZoneDetectorStrategy.verifySuggestManualTimeZoneCalled(timeZoneSuggestion);
|
||||
mFakeTimeZoneDetectorStrategy.verifySuggestManualTimeZoneCalled(timeZoneSuggestion);
|
||||
|
||||
verify(mMockContext).enforceCallingOrSelfPermission(
|
||||
eq(android.Manifest.permission.SUGGEST_MANUAL_TIME_AND_ZONE),
|
||||
@@ -261,7 +265,7 @@ public class TimeZoneDetectorServiceTest {
|
||||
anyString());
|
||||
|
||||
mTestHandler.waitForMessagesToBeProcessed();
|
||||
mStubbedTimeZoneDetectorStrategy.verifySuggestTelephonyTimeZoneCalled(timeZoneSuggestion);
|
||||
mFakeTimeZoneDetectorStrategy.verifySuggestTelephonyTimeZoneCalled(timeZoneSuggestion);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -269,25 +273,26 @@ public class TimeZoneDetectorServiceTest {
|
||||
when(mMockContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP))
|
||||
.thenReturn(PackageManager.PERMISSION_GRANTED);
|
||||
|
||||
mTimeZoneDetectorService.dump(null, null, null);
|
||||
PrintWriter pw = new PrintWriter(new StringWriter());
|
||||
mTimeZoneDetectorService.dump(null, pw, null);
|
||||
|
||||
verify(mMockContext).checkCallingOrSelfPermission(eq(android.Manifest.permission.DUMP));
|
||||
mStubbedTimeZoneDetectorStrategy.verifyDumpCalled();
|
||||
mFakeTimeZoneDetectorStrategy.verifyDumpCalled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoTimeZoneDetectionChanged() throws Exception {
|
||||
mTimeZoneDetectorService.handleAutoTimeZoneDetectionChanged();
|
||||
mTimeZoneDetectorService.handleAutoTimeZoneConfigChanged();
|
||||
mTestHandler.assertTotalMessagesEnqueued(1);
|
||||
mTestHandler.waitForMessagesToBeProcessed();
|
||||
mStubbedTimeZoneDetectorStrategy.verifyHandleAutoTimeZoneConfigChangedCalled();
|
||||
mFakeTimeZoneDetectorStrategy.verifyHandleAutoTimeZoneConfigChangedCalled();
|
||||
|
||||
mStubbedTimeZoneDetectorStrategy.resetCallTracking();
|
||||
mFakeTimeZoneDetectorStrategy.resetCallTracking();
|
||||
|
||||
mTimeZoneDetectorService.handleAutoTimeZoneDetectionChanged();
|
||||
mTimeZoneDetectorService.handleAutoTimeZoneConfigChanged();
|
||||
mTestHandler.assertTotalMessagesEnqueued(2);
|
||||
mTestHandler.waitForMessagesToBeProcessed();
|
||||
mStubbedTimeZoneDetectorStrategy.verifyHandleAutoTimeZoneConfigChangedCalled();
|
||||
mFakeTimeZoneDetectorStrategy.verifyHandleAutoTimeZoneConfigChangedCalled();
|
||||
}
|
||||
|
||||
private static TimeZoneConfiguration createTimeZoneConfiguration(
|
||||
|
||||
@@ -48,13 +48,13 @@ import android.app.timezonedetector.TelephonyTimeZoneSuggestion.MatchType;
|
||||
import android.app.timezonedetector.TelephonyTimeZoneSuggestion.Quality;
|
||||
import android.app.timezonedetector.TimeZoneCapabilities;
|
||||
import android.app.timezonedetector.TimeZoneConfiguration;
|
||||
import android.util.IndentingPrintWriter;
|
||||
|
||||
import com.android.server.timezonedetector.TimeZoneDetectorStrategyImpl.QualifiedTelephonyTimeZoneSuggestion;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -119,7 +119,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
@Test
|
||||
public void testGetCapabilities() {
|
||||
new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
TimeZoneCapabilities expectedCapabilities = mFakeCallback.getCapabilities(USER_ID);
|
||||
assertEquals(expectedCapabilities, mTimeZoneDetectorStrategy.getCapabilities(USER_ID));
|
||||
}
|
||||
@@ -127,17 +128,19 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
@Test
|
||||
public void testGetConfiguration() {
|
||||
new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
TimeZoneConfiguration expectedConfiguration = mFakeCallback.getConfiguration(USER_ID);
|
||||
assertTrue(expectedConfiguration.isComplete());
|
||||
assertEquals(expectedConfiguration, mTimeZoneDetectorStrategy.getConfiguration(USER_ID));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCapabilitiesTestInfra_owner() {
|
||||
public void testCapabilitiesTestInfra_unrestricted() {
|
||||
Script script = new Script();
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
script.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
TimeZoneCapabilities capabilities = mFakeCallback.getCapabilities(USER_ID);
|
||||
@@ -145,7 +148,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
assertEquals(CAPABILITY_NOT_APPLICABLE, capabilities.getSuggestManualTimeZone());
|
||||
}
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED);
|
||||
script.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
TimeZoneCapabilities capabilities = mFakeCallback.getCapabilities(USER_ID);
|
||||
@@ -155,10 +159,11 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCapabilitiesTestInfra_nonOwner() {
|
||||
public void testCapabilitiesTestInfra_restricted() {
|
||||
Script script = new Script();
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.NON_OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
script.initializeUser(USER_ID, UserCase.RESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
TimeZoneCapabilities capabilities = mFakeCallback.getCapabilities(USER_ID);
|
||||
@@ -166,7 +171,7 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
assertEquals(CAPABILITY_NOT_ALLOWED, capabilities.getSuggestManualTimeZone());
|
||||
}
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.NON_OWNER,
|
||||
script.initializeUser(USER_ID, UserCase.RESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
@@ -177,10 +182,10 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCapabilitiesTestInfra_ownerAutoDetectNotSupported() {
|
||||
public void testCapabilitiesTestInfra_autoDetectNotSupported() {
|
||||
Script script = new Script();
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
script.initializeUser(USER_ID, UserCase.AUTO_DETECT_NOT_SUPPORTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
@@ -189,7 +194,7 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
assertEquals(CAPABILITY_POSSESSED, capabilities.getSuggestManualTimeZone());
|
||||
}
|
||||
|
||||
script.initializeUser(USER_ID, UserCase.OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
script.initializeUser(USER_ID, UserCase.AUTO_DETECT_NOT_SUPPORTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED);
|
||||
{
|
||||
// Check the fake test infra is doing what is expected.
|
||||
@@ -200,9 +205,10 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConfiguration_owner() {
|
||||
public void testUpdateConfiguration_unrestricted() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
|
||||
// Set the configuration with auto detection enabled.
|
||||
script.simulateUpdateConfiguration(USER_ID, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
@@ -225,9 +231,9 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConfiguration_nonOwner() {
|
||||
public void testUpdateConfiguration_restricted() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.NON_OWNER,
|
||||
.initializeUser(USER_ID, UserCase.RESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
|
||||
// Try to update the configuration with auto detection disabled.
|
||||
@@ -244,9 +250,9 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConfiguration_ownerAutoDetectNotSupported() {
|
||||
public void testUpdateConfiguration_autoDetectNotSupported() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
.initializeUser(USER_ID, UserCase.AUTO_DETECT_NOT_SUPPORTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
|
||||
// Try to update the configuration with auto detection disabled.
|
||||
@@ -269,7 +275,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
TelephonyTimeZoneSuggestion slotIndex2TimeZoneSuggestion =
|
||||
createEmptySlotIndex2Suggestion();
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
script.simulateTelephonyTimeZoneSuggestion(slotIndex1TimeZoneSuggestion)
|
||||
@@ -311,7 +318,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
QUALITY_SINGLE_ZONE, TELEPHONY_SCORE_HIGH);
|
||||
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
|
||||
// A low quality suggestions will not be taken: The device time zone setting is left
|
||||
// uninitialized.
|
||||
@@ -376,7 +384,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
|
||||
for (TelephonyTestCase testCase : TELEPHONY_TEST_CASES) {
|
||||
// Start with the device in a known state.
|
||||
script.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
script.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
TelephonyTimeZoneSuggestion suggestion =
|
||||
@@ -427,7 +436,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
@Test
|
||||
public void testTelephonySuggestionsSingleSlotId() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
for (TelephonyTestCase testCase : TELEPHONY_TEST_CASES) {
|
||||
@@ -493,7 +503,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
TELEPHONY_SCORE_NONE);
|
||||
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID)
|
||||
// Initialize the latest suggestions as empty so we don't need to worry about nulls
|
||||
// below for the first loop.
|
||||
@@ -579,7 +590,8 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
@Test
|
||||
public void testTelephonySuggestionTimeZoneDetectorStrategyDoesNotAssumeCurrentSetting() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED);
|
||||
|
||||
TelephonyTestCase testCase = newTelephonyTestCase(
|
||||
MATCH_TYPE_NETWORK_COUNTRY_AND_OFFSET, QUALITY_SINGLE_ZONE, TELEPHONY_SCORE_HIGH);
|
||||
@@ -613,9 +625,10 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_owner_simulateAutoTimeZoneEnabled() {
|
||||
public void testManualSuggestion_unrestricted_simulateAutoTimeZoneEnabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
// Auto time zone detection is enabled so the manual suggestion should be ignored.
|
||||
@@ -625,9 +638,9 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_nonOwner_simulateAutoTimeZoneEnabled() {
|
||||
public void testManualSuggestion_restricted_simulateAutoTimeZoneEnabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.NON_OWNER,
|
||||
.initializeUser(USER_ID, UserCase.RESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
@@ -638,9 +651,9 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_ownerAutoDetectNotSupported_simulateAutoTimeZoneEnabled() {
|
||||
public void testManualSuggestion_autoDetectNotSupported_simulateAutoTimeZoneEnabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
.initializeUser(USER_ID, UserCase.AUTO_DETECT_NOT_SUPPORTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_ENABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
@@ -652,9 +665,10 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_owner_autoTimeZoneDetectionDisabled() {
|
||||
public void testManualSuggestion_unrestricted_autoTimeZoneDetectionDisabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER, CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
// Auto time zone detection is disabled so the manual suggestion should be used.
|
||||
@@ -665,13 +679,13 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_nonOwner_autoTimeZoneDetectionDisabled() {
|
||||
public void testManualSuggestion_restricted_autoTimeZoneDetectionDisabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.NON_OWNER,
|
||||
.initializeUser(USER_ID, UserCase.RESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
// Only owners have the capability.
|
||||
// Restricted users do not have the capability.
|
||||
ManualTimeZoneSuggestion manualSuggestion = createManualSuggestion("Europe/Paris");
|
||||
script.simulateManualTimeZoneSuggestion(
|
||||
USER_ID, manualSuggestion, false /* expectedResult */)
|
||||
@@ -679,13 +693,13 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testManualSuggestion_ownerAutoDetectNotSupported_autoTimeZoneDetectionDisabled() {
|
||||
public void testManualSuggestion_autoDetectNotSupported_autoTimeZoneDetectionDisabled() {
|
||||
Script script = new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
.initializeUser(USER_ID, UserCase.AUTO_DETECT_NOT_SUPPORTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
// Only owners have the capability.
|
||||
// Unrestricted users have the capability.
|
||||
ManualTimeZoneSuggestion manualSuggestion = createManualSuggestion("Europe/Paris");
|
||||
script.simulateManualTimeZoneSuggestion(
|
||||
USER_ID, manualSuggestion, true /* expectedResult */)
|
||||
@@ -695,22 +709,22 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
@Test
|
||||
public void testAddDumpable() {
|
||||
new Script()
|
||||
.initializeUser(USER_ID, UserCase.OWNER,
|
||||
.initializeUser(USER_ID, UserCase.UNRESTRICTED,
|
||||
CONFIG_AUTO_TIME_ZONE_DETECTION_DISABLED)
|
||||
.initializeTimeZoneSetting(ARBITRARY_TIME_ZONE_ID);
|
||||
|
||||
AtomicBoolean dumpCalled = new AtomicBoolean(false);
|
||||
class FakeDumpable implements Dumpable {
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
public void dump(IndentingPrintWriter pw, String[] args) {
|
||||
dumpCalled.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
mTimeZoneDetectorStrategy.addDumpable(new FakeDumpable());
|
||||
PrintWriter pw = new PrintWriter(new StringWriter());
|
||||
IndentingPrintWriter ipw = new IndentingPrintWriter(new StringWriter());
|
||||
String[] args = {"ArgOne", "ArgTwo"};
|
||||
mTimeZoneDetectorStrategy.dump(pw, args);
|
||||
mTimeZoneDetectorStrategy.dump(ipw, args);
|
||||
|
||||
assertTrue(dumpCalled.get());
|
||||
}
|
||||
@@ -912,12 +926,15 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
|
||||
/** Simulated user test cases. */
|
||||
enum UserCase {
|
||||
/** A catch-all for users that can set time zone config. */
|
||||
OWNER,
|
||||
/** A catch-all for users that can't set time zone config. */
|
||||
NON_OWNER,
|
||||
/** Owner, but auto tz detection is not supported on the device. */
|
||||
OWNER_AUTO_DETECT_NOT_SUPPORTED,
|
||||
/** A catch-all for users that can set auto time zone config. */
|
||||
UNRESTRICTED,
|
||||
/** A catch-all for users that can't set auto time zone config. */
|
||||
RESTRICTED,
|
||||
/**
|
||||
* Like {@link #UNRESTRICTED}, but auto tz detection is not
|
||||
* supported on the device.
|
||||
*/
|
||||
AUTO_DETECT_NOT_SUPPORTED,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -927,7 +944,7 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
private static TimeZoneCapabilities createCapabilities(
|
||||
int userId, UserCase userRole, TimeZoneConfiguration configuration) {
|
||||
switch (userRole) {
|
||||
case OWNER: {
|
||||
case UNRESTRICTED: {
|
||||
int suggestManualTimeZoneCapability = configuration.isAutoDetectionEnabled()
|
||||
? CAPABILITY_NOT_APPLICABLE : CAPABILITY_POSSESSED;
|
||||
return new TimeZoneCapabilities.Builder(userId)
|
||||
@@ -935,14 +952,14 @@ public class TimeZoneDetectorStrategyImplTest {
|
||||
.setSuggestManualTimeZone(suggestManualTimeZoneCapability)
|
||||
.build();
|
||||
}
|
||||
case NON_OWNER: {
|
||||
case RESTRICTED: {
|
||||
return new TimeZoneCapabilities.Builder(userId)
|
||||
.setConfigureAutoDetectionEnabled(CAPABILITY_NOT_ALLOWED)
|
||||
.setSuggestManualTimeZone(CAPABILITY_NOT_ALLOWED)
|
||||
.build();
|
||||
|
||||
}
|
||||
case OWNER_AUTO_DETECT_NOT_SUPPORTED: {
|
||||
case AUTO_DETECT_NOT_SUPPORTED: {
|
||||
return new TimeZoneCapabilities.Builder(userId)
|
||||
.setConfigureAutoDetectionEnabled(CAPABILITY_NOT_SUPPORTED)
|
||||
.setSuggestManualTimeZone(CAPABILITY_POSSESSED)
|
||||
|
||||
Reference in New Issue
Block a user