Merge "Add MANAGE_UNKNOWN_APP_SOURCES intent to stubs" into qt-dev
diff --git a/service/src/com/android/car/CarPowerManagementService.java b/service/src/com/android/car/CarPowerManagementService.java
index 7ff1ed9..b20ccc8 100644
--- a/service/src/com/android/car/CarPowerManagementService.java
+++ b/service/src/com/android/car/CarPowerManagementService.java
@@ -22,6 +22,7 @@
import android.car.userlib.CarUserManagerHelper;
import android.content.Context;
import android.hardware.automotive.vehicle.V2_0.VehicleApPowerStateReq;
+import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -30,6 +31,7 @@
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.Log;
@@ -98,6 +100,10 @@
private static int sShutdownPrepareTimeMs = MIN_MAX_GARAGE_MODE_DURATION_MS;
+ // in secs
+ private static final String PROP_MAX_GARAGE_MODE_DURATION_OVERRIDE =
+ "android.car.garagemodeduration";
+
private class PowerManagerCallbackList extends RemoteCallbackList<ICarPowerStateListener> {
/**
* Old version of {@link #onCallbackDied(E, Object)} that
@@ -386,6 +392,18 @@
private void doHandlePreprocessing() {
int pollingCount = (sShutdownPrepareTimeMs / SHUTDOWN_POLLING_INTERVAL_MS) + 1;
+ if (Build.IS_USERDEBUG || Build.IS_ENG) {
+ int shutdownPrepareTimeOverrideInSecs =
+ SystemProperties.getInt(PROP_MAX_GARAGE_MODE_DURATION_OVERRIDE, -1);
+ if (shutdownPrepareTimeOverrideInSecs >= 0) {
+ pollingCount =
+ (shutdownPrepareTimeOverrideInSecs * 1000 / SHUTDOWN_POLLING_INTERVAL_MS)
+ + 1;
+ Log.i(CarLog.TAG_POWER,
+ "Garage mode duration overridden secs:"
+ + shutdownPrepareTimeOverrideInSecs);
+ }
+ }
Log.i(CarLog.TAG_POWER, "processing before shutdown expected for: "
+ sShutdownPrepareTimeMs + " ms, adding polling:" + pollingCount);
synchronized (CarPowerManagementService.this) {