summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2018-02-27 14:41:52 -0700
committerJeff Sharkey <jsharkey@android.com>2018-02-27 14:42:05 -0700
commitf2b7bb1f61d329b7f30bcd06aade82a6d6e6e9c8 (patch)
tree4d318323ed98576cab01b9f3e03f6d16a790123c /src
parent8687813881fe8eddcae89def4a2a2042e7fe91ad (diff)
downloadandroid_packages_apps_PackageInstaller-f2b7bb1f61d329b7f30bcd06aade82a6d6e6e9c8.tar.gz
android_packages_apps_PackageInstaller-f2b7bb1f61d329b7f30bcd06aade82a6d6e6e9c8.tar.bz2
android_packages_apps_PackageInstaller-f2b7bb1f61d329b7f30bcd06aade82a6d6e6e9c8.zip
Force loading of safe labels in PackageInstaller.
It's too easy for code to accidentally use loadLabel() when building strings for security sensitive contexts, so add ability for a process to always force loading of safe strings. Test: builds, boots Bug: 73657770 Change-Id: I0964f39dbaee4f09c2568036060b66196f1dd782
Diffstat (limited to 'src')
-rw-r--r--src/com/android/packageinstaller/PackageInstallerApplication.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/com/android/packageinstaller/PackageInstallerApplication.java b/src/com/android/packageinstaller/PackageInstallerApplication.java
new file mode 100644
index 00000000..9b7e64e8
--- /dev/null
+++ b/src/com/android/packageinstaller/PackageInstallerApplication.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.packageinstaller;
+
+import android.app.Application;
+import android.content.pm.PackageItemInfo;
+
+public class PackageInstallerApplication extends Application {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ PackageItemInfo.setForceSafeLabels(true);
+ }
+}