• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package android.os;
18 
19 /** @hide */
20 interface ITradeInMode {
21     /**
22      * Enable adb in limited-privilege trade-in mode. Returns true if trade-in
23      * mode was enabled.
24      *
25      * Trade-in mode can be enabled if the following conditions are all true:
26      *   ro.debuggable is 0.
27      *   Settings.Global.ADB_ENABLED is 0.
28      *   Settings.Global.USER_SETUP_COMPLETE is 0.
29      *   Settings.Secure.DEVICE_PROVISIONED is 0.
30      *
31      * It is stopped automatically when any of the following conditions become
32      * true:
33      *
34      *   Settings.Global.USER_SETUP_COMPLETE is 1.
35      *   Settings.Secure.DEVICE_PROVISIONED is 1.
36      *   A change in network configuration occurs.
37      *   An account is added.
38      *
39      * ENTER_TRADE_IN_MODE permission is required.
40      */
start()41     boolean start();
42 
43     /**
44      * Returns whether evaluation mode is allowed on this device. It will return
45      * false if any kind of device protection (such as FRP) is detected.
46      *
47      * ENTER_TRADE_IN_MODE permission is required.
48      */
isEvaluationModeAllowed()49     boolean isEvaluationModeAllowed();
50 
51     /**
52      * Enable full adb access and provision the device. This forces a factory
53      * reset on the next boot.
54      *
55      * This will return false if start() was not called, if factory reset
56      * protection is active, or if trade-in mode was disabled due to any of the
57      * conditions listed above for start().
58      *
59      * ENTER_TRADE_IN_MODE permission is required.
60      */
enterEvaluationMode()61     boolean enterEvaluationMode();
62 
63     /**
64      * Schedules a wipe to trigger SUW for trade-in mode testing. A reboot is
65      * required. After this, startTesting() can be called.
66      *
67      * ENTER_TRADE_IN_MODE permission is required and ro.debuggable must be 1.
68      */
scheduleWipeForTesting()69     void scheduleWipeForTesting();
70 
71     /**
72      * Enables testing. This only takes effect after the next reboot, and is
73      * only allowed in ro.debuggable builds. On the following boot, normal
74      * adbd will be disabled and trade-in mode adbd will be enabled instead.
75      *
76      * ENTER_TRADE_IN_MODE permission is required and ro.debuggable must be 1.
77      */
startTesting()78     void startTesting();
79 
80     /**
81      * Disables testing. This disables trade-in mode and removes any scheduled
82      * trade-in mode wipe.
83      *
84      * ENTER_TRADE_IN_MODE permission is required, ro.debuggable must be 1, and
85      * startTesting() must have been called.
86      */
stopTesting()87     void stopTesting();
88 
89     /**
90      * Returns whether the device is testing trade-in mode.
91      *
92      * ENTER_TRADE_IN_MODE permission is required and ro.debuggable must be 1.
93      */
isTesting()94     boolean isTesting();
95 }
96