diff --git a/AndroidManifest.xml b/AndroidManifest.xml index bc0cd97685..312353267a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -56,6 +56,7 @@ android:enabled="true"> + diff --git a/build.gradle b/build.gradle index 534ca65115..9b9085945b 100644 --- a/build.gradle +++ b/build.gradle @@ -10,8 +10,28 @@ buildscript { } } -final String ANDROID_TOP = "${rootDir}/../../.." -final String FRAMEWORK_PREBUILTS_DIR = "${ANDROID_TOP}/prebuilts/framework_intermediates/" +final String FRAMEWORK_PREBUILTS_DIR = "prebuilts" + +allprojects { + repositories { + google() + mavenCentral() + jcenter() + maven { url 'https://jitpack.io' } + } + + ext.addFrameworkJar = { String path -> + def frameworkJar = new File(rootProject.projectDir, 'prebuilts/libs/' + path) + if (!frameworkJar.exists()) { + throw new IllegalArgumentException("Framework jar path doesn't exist") + } + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.bootstrapClasspath = files([frameworkJar] + (options.bootstrapClasspath.files as Iterable)) + } + } + } +} apply plugin: 'com.android.application' apply plugin: 'com.google.protobuf' @@ -47,13 +67,13 @@ android { productFlavors { aosp { dimension "app" - applicationId 'com.android.launcher3' + applicationId 'ch.deletescape.lawnchair' testApplicationId 'com.android.launcher3.tests' } l3go { dimension "app" - applicationId 'com.android.launcher3' + applicationId 'ch.deletescape.lawnchair' testApplicationId 'com.android.launcher3.tests' } @@ -132,6 +152,8 @@ android { manifest.srcFile "quickstep/AndroidManifest.xml" } } + + addFrameworkJar('framework.jar') } allprojects { @@ -151,9 +173,10 @@ dependencies { implementation project(':IconLoader') withQuickstepImplementation project(':SharedLibWrapper') implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'launcher_protos.jar') + implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'sysui_statslog.jar') // Recents lib dependency - withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/quickstep/libs", include: 'sysui_shared.jar') + withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'sysui_shared.jar') // Required for AOSP to compile. This is already included in the sysui_shared.jar withoutQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'plugin_core.jar') @@ -166,6 +189,8 @@ dependencies { androidTestImplementation 'com.android.support.test:rules:1.0.0' androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' androidTestImplementation "androidx.annotation:annotation:${ANDROID_X_VERSION}" + implementation 'com.google.protobuf.nano:protobuf-javanano:3.1.0' + implementation 'com.github.ChickenHook:RestrictionBypass:2.2' } protobuf { diff --git a/gradle.properties b/gradle.properties index 7a51375653..a38def522f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ PROTOBUF_CLASS_PATH=com.google.protobuf:protobuf-gradle-plugin:0.8.8 PROTOBUF_DEPENDENCY=com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7 BUILD_TOOLS_VERSION=28.0.3 -COMPILE_SDK=android-R +COMPILE_SDK=android-30 diff --git a/prebuilts/libs/framework.jar b/prebuilts/libs/framework.jar new file mode 100755 index 0000000000..6402c72f50 Binary files /dev/null and b/prebuilts/libs/framework.jar differ diff --git a/prebuilts/libs/launcher_protos.jar b/prebuilts/libs/launcher_protos.jar new file mode 100644 index 0000000000..195cf7109f Binary files /dev/null and b/prebuilts/libs/launcher_protos.jar differ diff --git a/prebuilts/libs/plugin_core.jar b/prebuilts/libs/plugin_core.jar new file mode 100644 index 0000000000..d5e3533daa Binary files /dev/null and b/prebuilts/libs/plugin_core.jar differ diff --git a/prebuilts/libs/sysui_shared.jar b/prebuilts/libs/sysui_shared.jar new file mode 100644 index 0000000000..8933be53c2 Binary files /dev/null and b/prebuilts/libs/sysui_shared.jar differ diff --git a/prebuilts/libs/sysui_statslog.jar b/prebuilts/libs/sysui_statslog.jar new file mode 100644 index 0000000000..62519993b8 Binary files /dev/null and b/prebuilts/libs/sysui_statslog.jar differ diff --git a/quickstep/AndroidManifest-launcher.xml b/quickstep/AndroidManifest-launcher.xml index d680507e3b..48dd687ff2 100644 --- a/quickstep/AndroidManifest-launcher.xml +++ b/quickstep/AndroidManifest-launcher.xml @@ -60,6 +60,7 @@ + { if (mIsDestroyed) return; + int usagePerm = mLauncher.checkCallingOrSelfPermission(Manifest.permission.PACKAGE_USAGE_STATS); + if (usagePerm != PackageManager.PERMISSION_GRANTED) { + mAppPredictor = null; + return; + } mAppPredictor = apm.createAppPredictionSession( new AppPredictionContext.Builder(mLauncher) .setUiSurface(PREDICTION_CLIENT) diff --git a/quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java b/quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java index 010694b0c5..a291843f3c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java +++ b/quickstep/src/com/android/launcher3/uioverrides/DeviceFlag.java @@ -61,23 +61,24 @@ public class DeviceFlag extends DebugFlag { } private void registerDeviceConfigChangedListener(Context context) { - DeviceConfig.addOnPropertiesChangedListener( - NAMESPACE_LAUNCHER, - context.getMainExecutor(), - properties -> { - if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace()) - || !properties.getKeyset().contains(key)) { - return; - } - defaultValue = getDeviceValue(key, mDefaultValueInCode); - initialize(context); - for (Runnable r: mListeners) { - r.run(); - } - }); +// DeviceConfig.addOnPropertiesChangedListener( +// NAMESPACE_LAUNCHER, +// context.getMainExecutor(), +// properties -> { +// if (!NAMESPACE_LAUNCHER.equals(properties.getNamespace()) +// || !properties.getKeyset().contains(key)) { +// return; +// } +// defaultValue = getDeviceValue(key, mDefaultValueInCode); +// initialize(context); +// for (Runnable r: mListeners) { +// r.run(); +// } +// }); } protected static boolean getDeviceValue(String key, boolean defaultValue) { - return DeviceConfig.getBoolean(NAMESPACE_LAUNCHER, key, defaultValue); + return defaultValue; +// return DeviceConfig.getBoolean(NAMESPACE_LAUNCHER, key, defaultValue); } } diff --git a/src/com/android/launcher3/MainProcessInitializer.java b/src/com/android/launcher3/MainProcessInitializer.java index 5f6ecb5510..b03c34b8e3 100644 --- a/src/com/android/launcher3/MainProcessInitializer.java +++ b/src/com/android/launcher3/MainProcessInitializer.java @@ -17,6 +17,7 @@ package com.android.launcher3; import android.content.Context; +import android.util.Log; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.BitmapCreationCheck; @@ -24,12 +25,23 @@ import com.android.launcher3.graphics.IconShape; import com.android.launcher3.logging.FileLog; import com.android.launcher3.util.ResourceBasedOverride; +import org.chickenhook.restrictionbypass.Unseal; + /** * Utility class to handle one time initializations of the main process */ public class MainProcessInitializer implements ResourceBasedOverride { + private static final String TAG = "MainProcessInitializer"; + public static void initialize(Context context) { + try { + Unseal.unseal(); + Log.i(TAG, "Unseal success!"); + } catch (Exception e) { + Log.e(TAG, "Unseal fail!"); + e.printStackTrace(); + } Overrides.getObject( MainProcessInitializer.class, context, R.string.main_process_initializer_class) .init(context);