summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremancebo <emancebo@cyngn.com>2015-07-08 13:15:05 -0700
committeremancebo <emancebo@cyngn.com>2015-07-09 14:27:28 -0700
commit5040ee674c50350eea91e97d7043c8cbed7d4113 (patch)
treec361702c7e2d22182f637d594cbbd145f7f08464
parentd3e0766d0a9fa0c2682883a89c575ee878a7e799 (diff)
downloadandroid_packages_apps_PackageInstaller-5040ee674c50350eea91e97d7043c8cbed7d4113.tar.gz
android_packages_apps_PackageInstaller-5040ee674c50350eea91e97d7043c8cbed7d4113.tar.bz2
android_packages_apps_PackageInstaller-5040ee674c50350eea91e97d7043c8cbed7d4113.zip
PackageInstaller: add hook to manage packages via PRE_BOOT_COMPLETED event
Change-Id: I797fd93eedd3c440bfd906c685bb6b11acb1c9c9
-rw-r--r--Android.mk6
-rw-r--r--AndroidManifest.xml9
-rw-r--r--pre_boot_listener/preboot.mk15
-rw-r--r--pre_boot_listener/src/com/android/packageinstaller/PackageInstallerPreBootListener.java27
4 files changed, 56 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index 092bf9c0..08f78abe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -4,7 +4,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
- $(call all-subdir-java-files) \
+ $(call all-java-files-under, src) \
src/com/android/packageinstaller/EventLogTags.logtags
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
@@ -14,4 +14,8 @@ LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+PRE_BOOT_LISTENER ?= $(LOCAL_PATH)/pre_boot_listener
+
+include $(PRE_BOOT_LISTENER)/preboot.mk
+
include $(BUILD_PACKAGE)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ca8777d0..43c82d86 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -14,6 +14,8 @@
<uses-permission android:name="android.permission.GRANT_REVOKE_PERMISSIONS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.READ_INSTALL_SESSIONS" />
+ <uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
+ <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<application android:label="@string/app_name"
android:allowBackup="false"
@@ -72,5 +74,12 @@
</intent-filter>
</activity>
+ <!-- Generic hook for managing packages pre boot -->
+ <receiver android:name="PackageInstallerPreBootListener">
+ <intent-filter>
+ <action android:name="android.intent.action.PRE_BOOT_COMPLETED"/>
+ </intent-filter>
+ </receiver>
+
</application>
</manifest>
diff --git a/pre_boot_listener/preboot.mk b/pre_boot_listener/preboot.mk
new file mode 100644
index 00000000..d25f7146
--- /dev/null
+++ b/pre_boot_listener/preboot.mk
@@ -0,0 +1,15 @@
+# Copyright (C) 2015 The CyanogenMod 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.
+
+LOCAL_SRC_FILES += $(call all-java-files-under, pre_boot_listener/src)
diff --git a/pre_boot_listener/src/com/android/packageinstaller/PackageInstallerPreBootListener.java b/pre_boot_listener/src/com/android/packageinstaller/PackageInstallerPreBootListener.java
new file mode 100644
index 00000000..bbc39ca2
--- /dev/null
+++ b/pre_boot_listener/src/com/android/packageinstaller/PackageInstallerPreBootListener.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2015 The CyanogenMod 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.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+// stub receiver
+public class PackageInstallerPreBootListener extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent broadcast) {}
+}