1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.adservices.shared.testing.device;
17 
18 /** Side-agnostic abstraction to interact with the {@code DeviceConfig}. */
19 public interface DeviceConfig {
20 
21     /** Sets the synchronization mode. */
setSyncDisabledMode(SyncDisabledModeForTest mode)22     DeviceConfig setSyncDisabledMode(SyncDisabledModeForTest mode);
23 
24     /** Gets the synchronization mode. */
getSyncDisabledMode()25     SyncDisabledModeForTest getSyncDisabledMode();
26 
27     /* Synchronization mode */
28     enum SyncDisabledModeForTest {
29         /** Only used on Android R. */
30         UNSUPPORTED(false),
31         /** Only used on Android S, as getter returns {@code true}, not until when */
32         DISABLED_SOMEHOW(false),
33         /** Not disabled. */
34         NONE(true),
35         /** Persistent even after reboot. */
36         PERSISTENT(true),
37         /** Persistent until next reboot. */
38         UNTIL_REBOOT(true);
39 
40         /** Whether it can be used on methods that sets the mode. */
isSettable()41         public boolean isSettable() {
42             return mSettable;
43         }
44 
45         private final boolean mSettable;
46 
SyncDisabledModeForTest(boolean settable)47         SyncDisabledModeForTest(boolean settable) {
48             mSettable = settable;
49         }
50     }
51 }
52