summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-08-05 17:57:43 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-08-05 17:57:43 +0000
commit72a487722f106bfc60f19f8e9fd6aedf3778b167 (patch)
treecd7a6e33be438581e705baf105ab02499d557bc0
parent363eab80b2bc0e53f94ebfa9206a8ebc0514d822 (diff)
parenta6d3cd1bb95af821d7911561422873c58579460d (diff)
Merge "PinnerService: add pinner.pin_camera to toggle camera pinning"
-rw-r--r--services/core/java/com/android/server/PinnerService.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/PinnerService.java b/services/core/java/com/android/server/PinnerService.java
index b0efd4389fae..80facbb3258c 100644
--- a/services/core/java/com/android/server/PinnerService.java
+++ b/services/core/java/com/android/server/PinnerService.java
@@ -95,6 +95,16 @@ public final class PinnerService extends SystemService {
private static final int KEY_CAMERA = 0;
private static final int KEY_HOME = 1;
+ // Pin the camera application.
+ private static boolean PROP_PIN_CAMERA = SystemProperties.getBoolean(
+ "pinner.pin_camera", true);
+ // Pin using pinlist.meta when pinning apps.
+ private static boolean PROP_PIN_PINLIST = SystemProperties.getBoolean(
+ "pinner.use_pinlist", true);
+ // Pin the whole odex/vdex/etc file when pinning apps.
+ private static boolean PROP_PIN_ODEX = SystemProperties.getBoolean(
+ "pinner.whole_odex", true);
+
private static final int MAX_CAMERA_PIN_SIZE = 80 * (1 << 20); // 80MB max for camera app.
private static final int MAX_HOME_PIN_SIZE = 6 * (1 << 20); // 6MB max for home app.
@@ -158,7 +168,11 @@ public final class PinnerService extends SystemService {
boolean shouldPinHome = context.getResources().getBoolean(
com.android.internal.R.bool.config_pinnerHomeApp);
if (shouldPinCamera) {
- mPinKeys.add(KEY_CAMERA);
+ if (PROP_PIN_CAMERA) {
+ mPinKeys.add(KEY_CAMERA);
+ } else if (DEBUG) {
+ Slog.i(TAG, "Pinner - skip pinning camera app");
+ }
}
if (shouldPinHome) {
mPinKeys.add(KEY_HOME);
@@ -589,10 +603,16 @@ public final class PinnerService extends SystemService {
pf = pinFile(file, pinSizeLimit, /*attemptPinIntrospection=*/false);
if (pf != null) {
synchronized (this) {
- pinnedApp.mFiles.add(pf);
+ if (PROP_PIN_ODEX) {
+ pinnedApp.mFiles.add(pf);
+ }
}
if (DEBUG) {
- Slog.i(TAG, "Pinned " + pf.fileName);
+ if (PROP_PIN_ODEX) {
+ Slog.i(TAG, "Pinned " + pf.fileName);
+ } else {
+ Slog.i(TAG, "Pinned [skip] " + pf.fileName);
+ }
}
}
}
@@ -686,6 +706,13 @@ public final class PinnerService extends SystemService {
* @return Open input stream or null on any error
*/
private static InputStream maybeOpenPinMetaInZip(ZipFile zipFile, String fileName) {
+ if (!PROP_PIN_PINLIST) {
+ if (DEBUG) {
+ Slog.i(TAG, "Pin - skip pinlist.meta in " + fileName);
+ }
+ return null;
+ }
+
ZipEntry pinMetaEntry = zipFile.getEntry(PIN_META_FILENAME);
InputStream pinMetaStream = null;
if (pinMetaEntry != null) {