Package com.unitech.api.power
Class PowerCtrl
java.lang.Object
com.unitech.api.power.PowerCtrl
The type Power ctrl.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBundleacquireWakeLock(long timeout) Acquires the wake lock.BundlechangeLongPressPowerButtonBehavior(int behavior) Change the behavior of long press power button.BundleColdBoot()Factory ResetBundleFactory Reset but keep eSIMBundleReleases the wake lock.
This method releases your claim to the CPU or screen being on.
The screen may turn off shortly after you release the wake lock, or it may not if there are other wake locks still held.BundleShutDown(boolean confirm) Turn off the device.BundleWarmBoot()Warm boot
-
Field Details
-
BUNDLE_ERROR_CODE
- See Also:
-
BUNDLE_ERROR_MSG
- See Also:
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR- See Also:
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS- See Also:
-
-
Constructor Details
-
PowerCtrl
public PowerCtrl(Context context) Instantiates a new Power ctrl.- Parameters:
context- the context
-
-
Method Details
-
ColdBoot
public Bundle ColdBoot()Factory Reset- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
ColdBootButKeepESIMs
public Bundle ColdBootButKeepESIMs()Factory Reset but keep eSIM- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
WarmBoot
public Bundle WarmBoot()Warm boot- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
acquireWakeLock
public Bundle acquireWakeLock(long timeout) Acquires the wake lock.
Ensures that the device is on at the PARTIAL_WAKE_LOCK level that the CPU is running; the screen and keyboard backlight will be allowed to go off.
The lock will be released after the given timeout expires if timeout is greater than 0.
The application which called this method with a 0 timeout must call releaseWakeLock() itself to avoid running down the device's battery excessively.- Parameters:
timeout- The timeout after which to release the wake lock, in milliseconds.
Set 0 then the power manager won't release this wake lock automatically.- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
releaseWakeLock
public Bundle releaseWakeLock()Releases the wake lock.
This method releases your claim to the CPU or screen being on.
The screen may turn off shortly after you release the wake lock, or it may not if there are other wake locks still held.- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
ShutDown
public Bundle ShutDown(boolean confirm) Turn off the device.- Parameters:
confirm- If true, shows a shutdown confirmation dialog.- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-
changeLongPressPowerButtonBehavior
public Bundle changeLongPressPowerButtonBehavior(int behavior) Change the behavior of long press power button.- Parameters:
behavior- 1: use Power menu, 5: Gemini, others: depends on OS behavior.- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
boolean Result = bundle.getBoolean("Result");
-