diff --git a/Android.bp b/Android.bp index 07c80efc891..f3e0428585c 100644 --- a/Android.bp +++ b/Android.bp @@ -146,7 +146,6 @@ java_library { "core/java/android/content/pm/dex/IArtManager.aidl", "core/java/android/content/pm/dex/ISnapshotRuntimeProfileCallback.aidl", "core/java/android/content/pm/permission/IRuntimePermissionPresenter.aidl", - "core/java/android/content/substratum/ISubstratumService.aidl", "core/java/android/database/IContentObserver.aidl", ":libcamera_client_aidl", ":libcamera_client_framework_aidl", @@ -394,7 +393,6 @@ java_library { "core/java/com/android/internal/os/IShellCallback.aidl", "core/java/com/android/internal/statusbar/IStatusBar.aidl", "core/java/com/android/internal/statusbar/IStatusBarService.aidl", - "core/java/com/android/internal/substratum/ISubstratumHelperService.aidl", "core/java/com/android/internal/textservice/ISpellCheckerService.aidl", "core/java/com/android/internal/textservice/ISpellCheckerServiceCallback.aidl", "core/java/com/android/internal/textservice/ISpellCheckerSession.aidl", diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 1e97d8ab002..ed6c25dc49c 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -70,11 +70,9 @@ static const char PRODUCT_BOOTANIMATION_FILE[] = "/product/media/bootanimation.z static const char SYSTEM_BOOTANIMATION_FILE[] = "/system/media/bootanimation.zip"; static const char PRODUCT_ENCRYPTED_BOOTANIMATION_FILE[] = "/product/media/bootanimation-encrypted.zip"; static const char SYSTEM_ENCRYPTED_BOOTANIMATION_FILE[] = "/system/media/bootanimation-encrypted.zip"; -static const char THEME_BOOTANIMATION_FILE[] = "/data/system/theme/bootanimation.zip"; static const char OEM_SHUTDOWNANIMATION_FILE[] = "/oem/media/shutdownanimation.zip"; static const char PRODUCT_SHUTDOWNANIMATION_FILE[] = "/product/media/shutdownanimation.zip"; static const char SYSTEM_SHUTDOWNANIMATION_FILE[] = "/system/media/shutdownanimation.zip"; -static const char THEME_SHUTDOWNANIMATION_FILE[] = "/data/system/theme/shutdownanimation.zip"; static const char SYSTEM_DATA_DIR_PATH[] = "/data/system"; static const char SYSTEM_TIME_DIR_NAME[] = "time"; @@ -325,9 +323,9 @@ status_t BootAnimation::readyToRun() { } } static const char* bootFiles[] = - {THEME_BOOTANIMATION_FILE, PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE}; + {PRODUCT_BOOTANIMATION_FILE, OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE}; static const char* shutdownFiles[] = - {THEME_SHUTDOWNANIMATION_FILE, PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE}; + {PRODUCT_SHUTDOWNANIMATION_FILE, OEM_SHUTDOWNANIMATION_FILE, SYSTEM_SHUTDOWNANIMATION_FILE}; for (const char* f : (!mShuttingDown ? bootFiles : shutdownFiles)) { if (access(f, R_OK) == 0) { diff --git a/core/java/android/content/om/OverlayInfo.java b/core/java/android/content/om/OverlayInfo.java index 9f7abf679d5..edacbb0bb2b 100644 --- a/core/java/android/content/om/OverlayInfo.java +++ b/core/java/android/content/om/OverlayInfo.java @@ -41,7 +41,6 @@ public final class OverlayInfo implements Parcelable { STATE_ENABLED_STATIC, STATE_TARGET_UPGRADING, STATE_OVERLAY_UPGRADING, - STATE_OVERLAY_NOT_AVAILABLE, }) @Retention(RetentionPolicy.SOURCE) public @interface State {} @@ -98,13 +97,6 @@ public final class OverlayInfo implements Parcelable { */ public static final int STATE_ENABLED_STATIC = 6; - /** - * The overlay package is currently disabled by the package manager. For - * all intents and purposes, outside the package manager, it is like the - * overlay package simply was not installed. - */ - public static final int STATE_OVERLAY_NOT_AVAILABLE = 7; - /** * Overlay category: theme. *

@@ -215,7 +207,6 @@ private void ensureValidState() { case STATE_ENABLED_STATIC: case STATE_TARGET_UPGRADING: case STATE_OVERLAY_UPGRADING: - case STATE_OVERLAY_NOT_AVAILABLE: break; default: throw new IllegalArgumentException("State " + state + " is not a valid state"); @@ -294,8 +285,6 @@ public static String stateToString(@State int state) { return "STATE_TARGET_UPGRADING"; case STATE_OVERLAY_UPGRADING: return "STATE_OVERLAY_UPGRADING"; - case STATE_OVERLAY_NOT_AVAILABLE: - return "STATE_OVERLAY_NOT_AVAILABLE"; default: return ""; } diff --git a/core/java/android/content/substratum/ISubstratumService.aidl b/core/java/android/content/substratum/ISubstratumService.aidl deleted file mode 100644 index 13bd2113e9c..00000000000 --- a/core/java/android/content/substratum/ISubstratumService.aidl +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Substratum - * - * 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 android.content.substratum; - -/** {@hide} */ -interface ISubstratumService { - - /** - * Install a list of specified overlay packages - * - * @param paths Filled in with a list of path names for packages to be installed from. - */ - void installOverlay(in List paths); - - /** - * Uninstall a list of specified overlay packages - * - * @param packages Filled in with a list of path names for packages to be installed from. - * @param restartUi Flag to automatically restart the SystemUI. - */ - void uninstallOverlay(in List packages, boolean restartUi); - - /** - * Switch the state of specified overlay packages - * - * @param packages Filled in with a list of package names to be switched. - * @param enable Whether to enable the specified overlays. - * @param restartUi Flag to automatically restart the SystemUI. - */ - void switchOverlay(in List packages, boolean enable, boolean restartUi); - - /** - * Change the priority of a specified list of overlays - * - * @param packages Filled in with a list of package names to be reordered. - * @param restartUi Flag to automatically restart the SystemUI. - */ - void setPriority(in List packages, boolean restartUi); - - /** - * Restart SystemUI - */ - void restartSystemUI(); - - /** - * Copy Method - * - * @param source Path of the source file. - * @param destination Path of the source file to be copied to. - */ - void copy(String source, String destination); - - /** - * Move Method - * - * @param source Path of the source file. - * @param destination Path of the source file to be moved to. - */ - void move(String source, String destination); - - /** - * Create Directory Method - * - * @param destination Path of the created destination folder. - */ - void mkdir(String destination); - - /** - * Delete Directory Method - * - * @param destination Path of the directory to be deleted. - * @param withParent Flag to automatically delete the folder encompassing the folder. - */ - void deleteDirectory(String directory, boolean withParent); - - /** - * Apply a specified bootanimation - * - * @param name Path to extract the bootanimation archive from. - */ - void applyBootanimation(String name); - - /** - * Apply a specified font pack - * - * @param name Path to extract the font archive from. - */ - void applyFonts(String pid, String fileName); - - /** - * Apply a specified sound pack - * - * @param name Path to extract the sounds archive from. - */ - void applySounds(String pid, String fileName); - - /** - * Profile Applicator - * - * @param enable Filled in with a list of package names to be enabled. - * @param disable Filled in with a list of package names to be disabled. - * @param name Name of the profile to be applied. - * @param restartUi Flag to automatically restart the SystemUI. - */ - void applyProfile(in List enable, in List disable, String name, - boolean restartUi); - - /** - * Apply a specified shutdownanimation - * - * @param name Path to extract the shutdown archive from. - * Use null to clear applied custom shutdown - */ - void applyShutdownAnimation(String name); - - /** - * Returns information about all installed overlay packages for the - * specified user. If there are no installed overlay packages for this user, - * an empty map is returned (i.e. null is never returned). The returned map is a - * mapping of target package names to lists of overlays. Each list for a - * given target package is sorted in priority order, with the overlay with - * the highest priority at the end of the list. - * - * @param uid The user to get the OverlayInfos for. - * @return A Map> with target package names - * mapped to lists of overlays; if no overlays exist for the - * requested user, an empty map is returned. - */ - Map getAllOverlays(in int uid); - - /** - * Request that an overlay package be enabled or disabled when possible to - * do so. - * - * It is always possible to disable an overlay, but due to technical and - * security reasons it may not always be possible to enable an overlay. An - * example of the latter is when the related target package is not - * installed. If the technical obstacle is later overcome, the overlay is - * automatically enabled at that point in time. - * - * An enabled overlay is a part of target package's resources, i.e. it will - * be part of any lookups performed via {@link android.content.res.Resources} - * and {@link android.content.res.AssetManager}. A disabled overlay will no - * longer affect the resources of the target package. If the target is - * currently running, its outdated resources will be replaced by new ones. - * This happens the same way as when an application enters or exits split - * window mode. - * - * @param packageName The name of the overlay package. - * @param enable true to enable the overlay, false to disable it. - * @param userId The user for which to change the overlay. - * @return true if the system successfully registered the request, false otherwise. - */ - boolean setEnabled(in String packageName, in boolean enable, in int userId); -} - diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index ac65791c6ff..bd23ae4c4ce 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -2367,8 +2367,7 @@ public Uri getCanonicalUri() { */ public void checkFileUriExposed(String location) { if ("file".equals(getScheme()) - && (getPath() != null) && !(getPath().startsWith("/system/") || - getPath().startsWith("/data/system/theme/"))) { + && (getPath() != null) && !getPath().startsWith("/system/")) { StrictMode.onFileUriExposed(this, location); } } diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index a37b7dea8e2..05bc6beca60 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -10610,13 +10610,6 @@ public boolean validate(@Nullable String value) { */ public static final String AMBIENT_VISUALIZER_ENABLED = "ambient_visualizer"; - /** - * Force authorize Substratum (or equivalent) frontend calling packages by ThemeInterfacer - * The value is boolean (1 or 0). - * @hide - */ - public static final String FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES = "force_authorize_substratum_packages"; - /** * Hide lockscreen shortcuts on secure lock screens * diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java index c6f73cb4757..c02f7ef65a7 100644 --- a/core/java/android/text/Layout.java +++ b/core/java/android/text/Layout.java @@ -1099,6 +1099,9 @@ private boolean[] primaryIsTrailingPreviousAllLineOffsets(int line) { if (limit > lineEnd) { limit = lineEnd; } + if (limit == start) { + continue; + } level[limit - lineStart - 1] = (byte) ((runs[i + 1] >>> RUN_LEVEL_SHIFT) & RUN_LEVEL_MASK); } @@ -1194,8 +1197,8 @@ private float getHorizontal(int offset, boolean trailing, int line, boolean clam } /** - * Computes in linear time the results of calling - * #getHorizontal for all offsets on a line. + * Computes in linear time the results of calling #getHorizontal for all offsets on a line. + * * @param line The line giving the offsets we compute information for * @param clamped Whether to clamp the results to the width of the layout * @param primary Whether the results should be the primary or the secondary horizontal @@ -1230,7 +1233,7 @@ private float[] getLineHorizontals(int line, boolean clamped, boolean primary) { TextLine.recycle(tl); if (clamped) { - for (int offset = 0; offset <= wid.length; ++offset) { + for (int offset = 0; offset < wid.length; ++offset) { if (wid[offset] > mWidth) { wid[offset] = mWidth; } diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java index d2ad3ab99b9..8c6772b32e5 100644 --- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java @@ -114,8 +114,11 @@ private boolean pulseOnLongPressAvailable() { } public boolean alwaysOnEnabled(int user) { - return boolSetting(Settings.Secure.DOZE_ALWAYS_ON, user, mAlwaysOnByDefault ? 1 : 0) - && alwaysOnAvailable() && !accessibilityInversionEnabled(user); + final boolean aodEnabledDefault = false; + final boolean aodEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.DOZE_ALWAYS_ON, aodEnabledDefault ? 1 : 0, user) != 0; + return aodEnabled && alwaysOnAvailable() + && !accessibilityInversionEnabled(user); } public boolean isDozeEnabled() { diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 8d4bc0662af..2a250faaf05 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -146,7 +146,6 @@ oneway interface IStatusBar void onFingerprintError(String error); // Used to hide the fingerprint dialog when the authenticationclient is stopped void hideFingerprintDialog(); - void handleInDisplayFingerprintView(boolean show, boolean isEnrolling); /** * LIQUID diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 36d355248f7..71135b976da 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -102,7 +102,6 @@ interface IStatusBarService void onFingerprintError(String error); // Used to hide the fingerprint dialog when the authenticationclient is stopped void hideFingerprintDialog(); - void handleInDisplayFingerprintView(boolean show, boolean isEnrolling); /** * LIQUID diff --git a/core/java/com/android/internal/substratum/ISubstratumHelperService.aidl b/core/java/com/android/internal/substratum/ISubstratumHelperService.aidl deleted file mode 100644 index 48dc20b5c5f..00000000000 --- a/core/java/com/android/internal/substratum/ISubstratumHelperService.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Substratum - * - * 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.internal.substratum; - -/** {@hide} */ -oneway interface ISubstratumHelperService { - void applyBootAnimation(); - void applyShutdownAnimation(); - void applyProfile(in String name); - void installOverlay(in List paths); -} diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index f6450b6ef86..c5be8e4a3ab 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -142,9 +142,6 @@ public static final class PermissionEntry { // Package names that are exempted from private API blacklisting final ArraySet mHiddenApiPackageWhitelist = new ArraySet<>(); - // These are the packages that are whitelisted to be the signature check for a theme system - final ArraySet mThemeSystemSignatureWhitelistedApps = new ArraySet<>(); - // The list of carrier applications which should be disabled until used. // This function suppresses update notifications for these pre-installed apps. // In SubscriptionInfoUpdater, the listed applications are disabled until used when all of the @@ -247,10 +244,6 @@ public ArraySet getBackupTransportWhitelist() { return mBackupTransportWhitelist; } - public ArraySet getThemeSystemSignatureWhitelistedApps() { - return mThemeSystemSignatureWhitelistedApps; - } - public ArraySet getDisabledUntilUsedPreinstalledCarrierApps() { return mDisabledUntilUsedPreinstalledCarrierApps; } @@ -633,15 +626,6 @@ private void readPermissionsFromXml(File permFile, int permissionFlag) { } } XmlUtils.skipCurrentTag(parser); - } else if ("theme-system-signature-whitelisted-app".equals(name) && allowAppConfigs) { - String pkgname = parser.getAttributeValue(null, "package"); - if (pkgname == null) { - Slog.w(TAG, " without package in " + permFile - + " at " + parser.getPositionDescription()); - } else { - mThemeSystemSignatureWhitelistedApps.add(pkgname); - } - XmlUtils.skipCurrentTag(parser); } else if ("disabled-until-used-preinstalled-carrier-associated-app".equals(name) && allowAppConfigs) { String pkgname = parser.getAttributeValue(null, "package"); diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp index ec07daa4c8c..c5904e0e9e5 100644 --- a/core/jni/fd_utils.cpp +++ b/core/jni/fd_utils.cpp @@ -87,15 +87,13 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const { static const char* kOverlaySubdir = "/system/vendor/overlay-subdir/"; static const char* kSystemProductOverlayDir = "/system/product/overlay/"; static const char* kProductOverlayDir = "/product/overlay"; - static const char* kThemeOverlayDir = "/data/system/theme"; static const char* kApkSuffix = ".apk"; if ((android::base::StartsWith(path, kOverlayDir) || android::base::StartsWith(path, kOverlaySubdir) || android::base::StartsWith(path, kVendorOverlayDir) || android::base::StartsWith(path, kSystemProductOverlayDir) - || android::base::StartsWith(path, kProductOverlayDir) - || android::base::StartsWith(path, kThemeOverlayDir)) + || android::base::StartsWith(path, kProductOverlayDir)) && android::base::EndsWith(path, kApkSuffix) && path.find("/../") == std::string::npos) { return true; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index fc968f848cb..420fffbb712 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -608,9 +608,6 @@ - - - diff --git a/core/res/res/drawable/ic_lock_bugreport.xml b/core/res/res/drawable/ic_lock_bugreport.xml index ebeb5320c34..3f9ed1f190d 100644 --- a/core/res/res/drawable/ic_lock_bugreport.xml +++ b/core/res/res/drawable/ic_lock_bugreport.xml @@ -18,7 +18,7 @@ android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" - android:tint="?attr/colorControlNormal"> + android:tint="@*android:color/accent_device_default_light"> diff --git a/core/res/res/drawable/ic_lock_idle_alarm.xml b/core/res/res/drawable/ic_lock_idle_alarm.xml index e8189bd111d..f1bc0e53d29 100644 --- a/core/res/res/drawable/ic_lock_idle_alarm.xml +++ b/core/res/res/drawable/ic_lock_idle_alarm.xml @@ -16,4 +16,4 @@ + android:tint="@*android:color/accent_device_default_light" /> diff --git a/core/res/res/drawable/ic_lock_lockdown.xml b/core/res/res/drawable/ic_lock_lockdown.xml index b9685d3e7cc..73ba1086b90 100644 --- a/core/res/res/drawable/ic_lock_lockdown.xml +++ b/core/res/res/drawable/ic_lock_lockdown.xml @@ -18,7 +18,7 @@ Copyright (C) 2018 The Android Open Source Project android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" - android:tint="?attr/colorControlNormal"> + android:tint="@*android:color/accent_device_default_light"> diff --git a/core/res/res/drawable/ic_lock_power_off.xml b/core/res/res/drawable/ic_lock_power_off.xml index cf778c77654..62a5955f3a4 100644 --- a/core/res/res/drawable/ic_lock_power_off.xml +++ b/core/res/res/drawable/ic_lock_power_off.xml @@ -18,7 +18,7 @@ android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" - android:tint="?attr/colorControlNormal"> + android:tint="@*android:color/accent_device_default_light"> diff --git a/core/res/res/drawable/ic_lock_screenrecord.xml b/core/res/res/drawable/ic_lock_screenrecord.xml index 3435cbbddb6..86f34cf4781 100644 --- a/core/res/res/drawable/ic_lock_screenrecord.xml +++ b/core/res/res/drawable/ic_lock_screenrecord.xml @@ -19,7 +19,7 @@ android:height="24dp" android:viewportWidth="96" android:viewportHeight="96" - android:tint="?attr/colorControlNormal"> + android:tint="@*android:color/accent_device_default_light"> + android:tint="@*android:color/accent_device_default_light"> diff --git a/core/res/res/drawable/ic_screenshot.xml b/core/res/res/drawable/ic_screenshot.xml index 8c8b2ceba6d..0b19e145e90 100644 --- a/core/res/res/drawable/ic_screenshot.xml +++ b/core/res/res/drawable/ic_screenshot.xml @@ -18,7 +18,7 @@ Copyright (C) 2018 The Android Open Source Project android:height="24.0dp" android:viewportWidth="24.0" android:viewportHeight="24.0" - android:tint="?attr/colorControlNormal"> + android:tint="@*android:color/accent_device_default_light"> diff --git a/core/res/res/values/custom_config.xml b/core/res/res/values/custom_config.xml index 1734ef41449..c8ee8ff1ed8 100644 --- a/core/res/res/values/custom_config.xml +++ b/core/res/res/values/custom_config.xml @@ -204,9 +204,4 @@ false - - false - - false - diff --git a/core/res/res/values/custom_symbols.xml b/core/res/res/values/custom_symbols.xml index 6d48aa4c47a..71b989b48b2 100644 --- a/core/res/res/values/custom_symbols.xml +++ b/core/res/res/values/custom_symbols.xml @@ -289,7 +289,4 @@ - - - diff --git a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java index 9b1f95ce2a6..6d5276f2423 100644 --- a/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java +++ b/core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java @@ -94,16 +94,6 @@ public void installPlatformSignedOverlay() throws Exception { assertTrue(overlayManagerContainsPackage(SIG_OVERLAY_PACKAGE_NAME)); } - @Test - public void installAndDisableOverlay() throws Exception { - final String pkgName = "com.android.server.om.hosttest.app_overlay"; - installPackage("OverlayHostTests_AppOverlayV1.apk"); - assertTrue(overlayManagerContainsPackage(pkgName)); - assertFalse(overlayManagerContainsPackage("--- " + pkgName)); - setPackageEnabled(pkgName, false); - assertTrue(overlayManagerContainsPackage("--- " + pkgName)); - } - @Test public void installPlatformSignedAppOverlayAndUpdate() throws Exception { assertTrue(runDeviceTests(DEVICE_TEST_PKG, DEVICE_TEST_CLS, "expectAppResource")); diff --git a/data/etc/Android.mk b/data/etc/Android.mk index f9ddefe178b..936ad22d4fc 100644 --- a/data/etc/Android.mk +++ b/data/etc/Android.mk @@ -47,20 +47,3 @@ LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/sysconfig LOCAL_SRC_FILES := $(LOCAL_MODULE) include $(BUILD_PREBUILT) - -######################## -include $(CLEAR_VARS) -LOCAL_MODULE := substratum-theme-feature.xml -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/sysconfig -LOCAL_SRC_FILES := $(LOCAL_MODULE) -include $(BUILD_PREBUILT) - -######################## -include $(CLEAR_VARS) -LOCAL_MODULE := substratum-sysconfig.xml -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/sysconfig -LOCAL_SRC_FILES := $(LOCAL_MODULE) -include $(BUILD_PREBUILT) diff --git a/data/etc/substratum-sysconfig.xml b/data/etc/substratum-sysconfig.xml deleted file mode 100644 index 1d6a161b000..00000000000 --- a/data/etc/substratum-sysconfig.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data/etc/substratum-theme-feature.xml b/data/etc/substratum-theme-feature.xml deleted file mode 100644 index b7d97fcd586..00000000000 --- a/data/etc/substratum-theme-feature.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 061e6c2a038..fc625bbaf72 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -73,9 +73,8 @@ static volatile int32_t gCount = 0; const char* AssetManager::RESOURCES_FILENAME = "resources.arsc"; const char* AssetManager::IDMAP_BIN = "/system/bin/idmap"; const char* AssetManager::OVERLAY_DIR = "/vendor/overlay"; -const char* AssetManager::THEME_OVERLAY_DIR = "/data/system/theme"; const char* AssetManager::PRODUCT_OVERLAY_DIR = "/product/overlay"; -const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "../../data/system/theme"; +const char* AssetManager::OVERLAY_THEME_DIR_PROPERTY = "ro.boot.vendor.overlay.theme"; const char* AssetManager::TARGET_PACKAGE_NAME = "android"; const char* AssetManager::TARGET_APK_PATH = "/system/framework/framework-res.apk"; const char* AssetManager::IDMAP_DIR = "/data/resource-cache"; diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h index 115ae0b735c..08da7319de8 100644 --- a/libs/androidfw/include/androidfw/AssetManager.h +++ b/libs/androidfw/include/androidfw/AssetManager.h @@ -60,7 +60,6 @@ class AssetManager : public AAssetManager { static const char* RESOURCES_FILENAME; static const char* IDMAP_BIN; static const char* OVERLAY_DIR; - static const char* THEME_OVERLAY_DIR; static const char* PRODUCT_OVERLAY_DIR; /* * If OVERLAY_THEME_DIR_PROPERTY is set, search for runtime resource overlay diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java index 9c94a574742..15cb9bd8fcd 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java @@ -190,11 +190,9 @@ private ApplicationsState(Application app) { // Only the owner can see all apps. mAdminRetrieveFlags = PackageManager.MATCH_ANY_USER | PackageManager.MATCH_DISABLED_COMPONENTS | - PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | - PackageManager.GET_META_DATA; + PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS; mRetrieveFlags = PackageManager.MATCH_DISABLED_COMPONENTS | - PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS | - PackageManager.GET_META_DATA; + PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS; /** * This is a trick to prevent the foreground thread from being delayed. @@ -1549,17 +1547,6 @@ public boolean filterApp(AppEntry entry) { } }; - public static final AppFilter FILTER_SUBSTRATUM = new AppFilter() { - public void init() { - } - - @Override - public boolean filterApp(AppEntry entry) { - return !((entry.info.metaData != null) && - (entry.info.metaData.getString("Substratum_Parent") != null)); - } - }; - public static final AppFilter FILTER_WORK = new AppFilter() { private int mCurrentUser; @@ -1631,6 +1618,7 @@ public boolean filterApp(AppEntry entry) { return false; } }; + public static final AppFilter FILTER_DISABLED = new AppFilter() { @Override public void init() { diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java index 93e56217939..505e019a654 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java @@ -126,7 +126,7 @@ public int getConnectionStatus(BluetoothDevice device) { public boolean isPreferred(BluetoothDevice device) { if (mService == null) return false; - return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF; + return mService.getPriority(device) != BluetoothProfile.PRIORITY_OFF; } public int getPreferred(BluetoothDevice device) { diff --git a/packages/SubstratumHelperService/Android.mk b/packages/SubstratumHelperService/Android.mk deleted file mode 100644 index 78908d9312d..00000000000 --- a/packages/SubstratumHelperService/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (C) 2018 Projekt Substratum -# -# 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_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_PROGUARD_ENABLED := disabled -LOCAL_REQUIRED_MODULES := \ - substratum-theme-feature.xml - -LOCAL_PACKAGE_NAME := SubstratumHelperService -LOCAL_PRIVATE_PLATFORM_APIS := true -LOCAL_CERTIFICATE := platform -LOCAL_PRIVILEGED_MODULE := true - -include $(BUILD_PACKAGE) \ No newline at end of file diff --git a/packages/SubstratumHelperService/AndroidManifest.xml b/packages/SubstratumHelperService/AndroidManifest.xml deleted file mode 100644 index d28dbc68c2f..00000000000 --- a/packages/SubstratumHelperService/AndroidManifest.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/SubstratumHelperService/src/projekt/substratum/helper/SubstratumHelperService.java b/packages/SubstratumHelperService/src/projekt/substratum/helper/SubstratumHelperService.java deleted file mode 100644 index 1f31abe9f7c..00000000000 --- a/packages/SubstratumHelperService/src/projekt/substratum/helper/SubstratumHelperService.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Substratum - * - * 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 projekt.substratum.helper; - -import android.app.Service; -import android.content.Intent; -import android.content.IIntentReceiver; -import android.content.IIntentSender; -import android.content.IntentSender; -import android.content.pm.PackageInstaller; -import android.content.pm.PackageInstaller.Session; -import android.content.pm.PackageInstaller.SessionParams; -import android.os.Binder; -import android.os.Bundle; -import android.os.Environment; -import android.os.FileUtils; -import android.os.IBinder; -import android.os.Process; -import android.os.SELinux; -import android.util.Log; - -import com.android.internal.substratum.ISubstratumHelperService; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.List; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.TimeUnit; - -public class SubstratumHelperService extends Service { - private static final String TAG = "SubstratumHelperService"; - - private final File EXTERNAL_CACHE_DIR = - new File(Environment.getExternalStorageDirectory(), ".substratum"); - private final File SYSTEM_THEME_DIR = new File(Environment.getDataSystemDirectory(), "theme"); - - ISubstratumHelperService mISubstratumHelperService = new ISubstratumHelperService.Stub() { - @Override - public void applyBootAnimation() { - if (!isAuthorized(Binder.getCallingUid())) return; - - File src = new File(EXTERNAL_CACHE_DIR, "bootanimation.zip"); - File dst = new File(SYSTEM_THEME_DIR, "bootanimation.zip"); - int perms = FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH; - - if (dst.exists()) dst.delete(); - FileUtils.copyFile(src, dst); - FileUtils.setPermissions(dst, perms, -1, -1); - SELinux.restorecon(dst); - src.delete(); - } - - @Override - public void applyShutdownAnimation() { - if (!isAuthorized(Binder.getCallingUid())) return; - - File src = new File(EXTERNAL_CACHE_DIR, "shutdownanimation.zip"); - File dst = new File(SYSTEM_THEME_DIR, "shutdownanimation.zip"); - int perms = FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH; - - if (dst.exists()) dst.delete(); - FileUtils.copyFile(src, dst); - FileUtils.setPermissions(dst, perms, -1, -1); - SELinux.restorecon(dst); - src.delete(); - } - - @Override - public void applyProfile(String name) { - if (!isAuthorized(Binder.getCallingUid())) return; - - FileUtils.deleteContents(SYSTEM_THEME_DIR); - - File profileDir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + - "/substratum/profiles/" + name + "/theme"); - if (profileDir.exists()) { - File profileFonts = new File(profileDir, "fonts"); - if (profileFonts.exists()) { - File dst = new File(SYSTEM_THEME_DIR, "fonts"); - copyDir(profileFonts, dst); - } - - File profileSounds = new File(profileDir, "audio"); - if (profileSounds.exists()) { - File dst = new File(SYSTEM_THEME_DIR, "audio"); - copyDir(profileSounds, dst); - } - - File profileBootAnimation = new File(profileDir, "bootanimation.zip"); - if (profileBootAnimation.exists()) { - File dst = new File(SYSTEM_THEME_DIR, "bootanimation.zip"); - FileUtils.copyFile(profileBootAnimation, dst); - int perms = FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH; - FileUtils.setPermissions(dst, perms, -1, -1); - } - - File profileShutdownAnimation = new File(profileDir, "shutdownanimation.zip"); - if (profileShutdownAnimation.exists()) { - File dst = new File(SYSTEM_THEME_DIR, "shutdownanimation.zip"); - FileUtils.copyFile(profileShutdownAnimation, dst); - int perms = FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IROTH; - FileUtils.setPermissions(dst, perms, -1, -1); - } - - SELinux.restorecon(SYSTEM_THEME_DIR); - } - } - - @Override - public void installOverlay(List paths) { - if (!isAuthorized(Binder.getCallingUid())) return; - LocalIntentReceiver receiver = new LocalIntentReceiver(); - for (String path : paths) { - //Settings.Global.putInt(mContext.getContentResolver(), - // Settings.Global.PACKAGE_VERIFIER_ENABLE, 0); - File apkFile = new File(path); - try { - //PackageParser.PackageLite pkg = PackageParser.parsePackageLite(apkFile, 0); - PackageInstaller installer = getPackageManager().getPackageInstaller(); - SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL); - int sessionId = installer.createSession(params); - try (PackageInstaller.Session session = installer.openSession(sessionId)) { - try (InputStream in = new FileInputStream(apkFile); - OutputStream apkStream = session.openWrite( - "base.apk", 0, apkFile.length())) { - byte[] buffer = new byte[32 * 1024]; - long size = apkFile.length(); - while (size > 0) { - long toRead = (buffer.length < size) ? buffer.length : size; - int didRead = in.read(buffer, 0, (int) toRead); - apkStream.write(buffer, 0, didRead); - size -= didRead; - } - } - session.commit(receiver.getIntentSender()); - } - } catch (IOException e) { - Log.e(TAG, "Install failed", e); - continue; - } - - Intent result = receiver.getResult(); - int status = result.getIntExtra(PackageInstaller.EXTRA_STATUS, - PackageInstaller.STATUS_FAILURE); - if (status == PackageInstaller.STATUS_SUCCESS) { - String installedPackageName = result.getStringExtra( - PackageInstaller.EXTRA_PACKAGE_NAME); - } else { - // ¯\_(ツ)_/¯ - } - } - } - - private boolean isAuthorized(int uid) { - return Process.SYSTEM_UID == uid; - } - - private boolean copyDir(File src, File dst) { - File[] files = src.listFiles(); - boolean success = true; - - if (files != null) { - for (File file : files) { - File newFile = new File(dst, file.getName()); - if (file.isDirectory()) { - success &= copyDir(file, newFile); - } else { - success &= FileUtils.copyFile(file, newFile); - } - } - } else { - // not a directory - success = false; - } - return success; - } - }; - - @Override - public IBinder onBind(Intent intent) { - return mISubstratumHelperService.asBinder(); - } - - private static class LocalIntentReceiver { - private final SynchronousQueue mResult = new SynchronousQueue<>(); - - private IIntentSender.Stub mLocalSender = new IIntentSender.Stub() { - @Override - public void send(int code, Intent intent, String resolvedType, IBinder whitelistToken, - IIntentReceiver finishedReceiver, String requiredPermission, Bundle options) { - try { - mResult.offer(intent, 5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - }; - - public IntentSender getIntentSender() { - return new IntentSender((IIntentSender) mLocalSender); - } - - public Intent getResult() { - try { - return mResult.take(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - } -} diff --git a/packages/SystemUI/Android.mk b/packages/SystemUI/Android.mk index 4d4069861ff..2963d49daad 100644 --- a/packages/SystemUI/Android.mk +++ b/packages/SystemUI/Android.mk @@ -60,9 +60,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ SystemUI-proto \ trail-drawing \ rebound \ - guava \ - vendor.oneplus.fingerprint.extension-V1.0-java \ - vendor.oneplus.hardware.display-V1.0-java + guava LOCAL_JAVA_LIBRARIES := telephony-common \ android.car \ diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml index 77caced598d..9e2e3d38192 100644 --- a/packages/SystemUI/AndroidManifest.xml +++ b/packages/SystemUI/AndroidManifest.xml @@ -318,16 +318,6 @@ - - - - - - - - - + 8dp + diff --git a/packages/SystemUI/res/values/custom_strings.xml b/packages/SystemUI/res/values/custom_strings.xml index 655b51a24e0..cd93a16b6d2 100644 --- a/packages/SystemUI/res/values/custom_strings.xml +++ b/packages/SystemUI/res/values/custom_strings.xml @@ -411,4 +411,11 @@ App Picker + Show charging watts + Show current charging watts value in mW + Show battery bar + Show battery bar on charging in always on display + Always show battery bar + Always show battery bar on charging + diff --git a/packages/SystemUI/res/xml/lockscreen_settings.xml b/packages/SystemUI/res/xml/lockscreen_settings.xml index 1e7d266cc5c..a8bd2a5a15b 100644 --- a/packages/SystemUI/res/xml/lockscreen_settings.xml +++ b/packages/SystemUI/res/xml/lockscreen_settings.xml @@ -39,4 +39,23 @@ android:title="@string/lockscreen_unlock_right" sysui:defValue="true" /> + + + + + + diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml index fb2aa9192c6..9659fb7aaf8 100644 --- a/packages/SystemUI/res/xml/tuner_prefs.xml +++ b/packages/SystemUI/res/xml/tuner_prefs.xml @@ -88,11 +88,6 @@ - - + sysui:defValue="false" /> diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 29bd183e516..bf897ab4bee 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -215,7 +215,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private boolean mKeyguardOccluded; @VisibleForTesting protected boolean mTelephonyCapable; - protected boolean mPulsing; // Device provisioning state private boolean mDeviceProvisioned; @@ -1880,7 +1879,6 @@ private void sendUpdates(KeyguardUpdateMonitorCallback callback) { callback.onClockVisibilityChanged(); callback.onKeyguardVisibilityChangedRaw(mKeyguardIsVisible); callback.onTelephonyCapable(mTelephonyCapable); - callback.onPulsing(mPulsing); for (Entry data : mSimDatas.entrySet()) { final SimData state = data.getValue(); callback.onSimStateChanged(state.subId, state.slotId, state.simState); @@ -2192,15 +2190,4 @@ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); } } - - public boolean setPulsing(boolean pulsing) { - mPulsing = pulsing; - for (int i = 0; i < mCallbacks.size(); i++) { - KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); - if (cb != null) { - cb.onPulsing(mPulsing); - } - } - return mPulsing; - } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java index 3e9a87d00d2..2cdd4a5886c 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java @@ -296,9 +296,4 @@ public void onTrustAgentErrorMessage(CharSequence message) { } */ public void onLogoutEnabledChanged() { } - /** - * Called when a pulsing is received. - */ - public void onPulsing(boolean pulsing) { } - } diff --git a/packages/SystemUI/src/com/android/systemui/SoundRefreshReceiver.java b/packages/SystemUI/src/com/android/systemui/SoundRefreshReceiver.java deleted file mode 100644 index 2d9a899ea63..00000000000 --- a/packages/SystemUI/src/com/android/systemui/SoundRefreshReceiver.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Substratum - * - * 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.systemui; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -import com.android.systemui.SystemUIApplication; -import com.android.systemui.keyguard.KeyguardViewMediator; - -public class SoundRefreshReceiver extends BroadcastReceiver { - public static String ACTION = "com.android.systemui.action.REFRESH_SOUND"; - - @Override - public void onReceive(Context context, Intent intent) { - if (ACTION.equals(intent.getAction())) { - ((SystemUIApplication) context.getApplicationContext()) - .getComponent(KeyguardViewMediator.class).refreshSounds(); - } - } -} diff --git a/packages/SystemUI/src/com/android/systemui/SysuiRestartReceiver.java b/packages/SystemUI/src/com/android/systemui/SysuiRestartReceiver.java index 75de186415a..cdeef2fbfad 100644 --- a/packages/SystemUI/src/com/android/systemui/SysuiRestartReceiver.java +++ b/packages/SystemUI/src/com/android/systemui/SysuiRestartReceiver.java @@ -25,19 +25,12 @@ public class SysuiRestartReceiver extends BroadcastReceiver { public static String ACTION = "com.android.systemui.action.RESTART"; - public static String ACTION_THEME = "com.android.systemui.action.RESTART_THEME"; @Override public void onReceive(Context context, Intent intent) { - boolean runAction = ACTION.equals(intent.getAction()); - boolean runThemeAction = ACTION_THEME.equals(intent.getAction()); - - if (runAction) { + if (ACTION.equals(intent.getAction())) { String pkg = intent.getData().toString().substring(10); NotificationManager.from(context).cancel(pkg, SystemMessage.NOTE_PLUGIN); - } - - if (runAction || runThemeAction) { Process.killProcess(Process.myPid()); } } diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleView.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleView.java deleted file mode 100644 index cdc24155bd8..00000000000 --- a/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleView.java +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Copyright (C) 2019 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.systemui.fingerprint; - -import android.app.KeyguardManager; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PixelFormat; -import android.content.Context; -import android.hardware.display.DisplayManager; -import android.os.PowerManager; -import android.os.RemoteException; -import android.os.ServiceManager; -import android.view.Display; -import android.view.Gravity; -import android.view.View.OnTouchListener; -import android.view.View; -import android.widget.ImageView; -import android.view.MotionEvent; -import android.view.WindowManager; -import android.util.Log; -import android.util.Slog; - -import com.android.keyguard.KeyguardUpdateMonitor; -import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.internal.telephony.IccCardConstants.State; -import com.android.systemui.R; - -import java.io.PrintWriter; - -import vendor.oneplus.hardware.display.V1_0.IOneplusDisplay; - -public class FODCircleView extends ImageView implements OnTouchListener { - private final int mX, mY, mW, mH; - private final Paint mPaintFingerprint = new Paint(); - private final Paint mPaintShow = new Paint(); - private IOneplusDisplay mDisplayDaemon = null; - private boolean mInsideCircle = false; - private final WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(); - - private final static float UNTOUCHED_DIM = .1f; - private final static float UNTOUCHED_DOZE_DIM = .4f; - private final static float TOUCHED_DIM = .9f; - - private final int DISPLAY_AOD_MODE = 8; - private final int DISPLAY_APPLY_HIDE_AOD = 11; - private final int DISPLAY_NOTIFY_PRESS = 9; - private final int DISPLAY_SET_DIM = 10; - - private final WindowManager mWM; - - private final int mCircleX = 444; - private final int mCircleY = 1966; - private final int mCircleSize = 190; - - private boolean mIsDreaming; - private boolean mIsPulsing; - private boolean mIsScreenOn; - private boolean mChange; - - public boolean viewAdded; - private boolean mIsEnrolling; - - KeyguardUpdateMonitor mUpdateMonitor; - - KeyguardUpdateMonitorCallback mMonitorCallback = new KeyguardUpdateMonitorCallback() { - @Override - public void onDreamingStateChanged(boolean dreaming) { - super.onDreamingStateChanged(dreaming); - mIsDreaming = dreaming; - mInsideCircle = false; - mChange = true; - } - - @Override - public void onPulsing(boolean pulsing) { - super.onPulsing(pulsing); - mIsPulsing = pulsing; - mInsideCircle = false; - mChange = true; - } - - @Override - public void onScreenTurnedOff() { - super.onScreenTurnedOff(); - mInsideCircle = false; - mChange = true; - } - - @Override - public void onStartedGoingToSleep(int why) { - super.onStartedGoingToSleep(why); - mInsideCircle = false; - mChange = true; - } - - @Override - public void onFinishedGoingToSleep(int why) { - super.onFinishedGoingToSleep(why); - mChange = true; - } - - @Override - public void onStartedWakingUp() { - try { - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 0); - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 0); - } catch (RemoteException e) {} - super.onStartedWakingUp(); - mChange = true; - } - - @Override - public void onScreenTurnedOn() { - super.onScreenTurnedOn(); - mIsScreenOn = true; - mInsideCircle = false; - mChange = true; - } - - @Override - public void onKeyguardVisibilityChanged(boolean showing) { - super.onKeyguardVisibilityChanged(showing); - mInsideCircle = false; - mChange = true; - } - - @Override - public void onKeyguardBouncerChanged(boolean isBouncer) { - if (viewAdded && isBouncer) { - hide(); - } else if (!viewAdded) { - show(); - } - mChange = true; - } - - @Override - public void onStrongAuthStateChanged(int userId) { - super.onStrongAuthStateChanged(userId); - mChange = true; - } - - @Override - public void onFingerprintAuthenticated(int userId) { - super.onFingerprintAuthenticated(userId); - mInsideCircle = false; - try { - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 0); - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 0); - } catch (RemoteException e) {} - mChange = true; - } - }; - - FODCircleView(Context context) { - super(context); - - mX = mCircleX; - mY = mCircleY; - mW = mCircleSize; - mH = mCircleSize; - - mPaintFingerprint.setAntiAlias(true); - mPaintFingerprint.setColor(Color.GREEN); - - setImageResource(R.drawable.fod_icon_default); - - mPaintShow.setAntiAlias(true); - mPaintShow.setColor(Color.argb(0x18, 0x00, 0xff, 0x00)); - setOnTouchListener(this); - mWM = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); - - try { - mDisplayDaemon = IOneplusDisplay.getService(); - } catch (Exception e) {} - - mUpdateMonitor = KeyguardUpdateMonitor.getInstance(context); - mUpdateMonitor.registerCallback(mMonitorCallback); - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - //TODO w!=h? - - if(mInsideCircle) { - canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintFingerprint); - try { - //if (mIsDreaming) { - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 2); - //} - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 1); - } catch (RemoteException e) {} - } else { - if (mChange) { - try { - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 0); - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 0); - //canvas.drawCircle(mW/2, mH/2, (float) (mW/2.0f), this.mPaintShow); - } catch (RemoteException e) {} - } - } - mChange = false; - } - - @Override - public boolean onTouch(View v, MotionEvent event) { - float x = event.getAxisValue(MotionEvent.AXIS_X); - float y = event.getAxisValue(MotionEvent.AXIS_Y); - - boolean newInside = (x > 0 && x < mW) && (y > 0 && y < mW); - - if(event.getAction() == MotionEvent.ACTION_UP) { - newInside = false; - try { - setImageResource(R.drawable.fod_icon_default); - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 0); - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 0); - } catch (RemoteException e) {} - } - - if(newInside == mInsideCircle) return mInsideCircle; - - mInsideCircle = newInside; - - invalidate(); - - if(!mInsideCircle) { - //mParams.screenBrightness = .0f; - setImageResource(R.drawable.fod_icon_default); - mParams.dimAmount = mIsDreaming ? UNTOUCHED_DOZE_DIM : UNTOUCHED_DIM; - mWM.updateViewLayout(this, mParams); - return false; - } - if (event.getAction() == MotionEvent.ACTION_DOWN) { - setImageResource(R.drawable.fod_icon_empty); - mParams.dimAmount = TOUCHED_DIM; - //mParams.screenBrightness = 1.0f; - mWM.updateViewLayout(this, mParams); - } - return true; - } - - public void show() { - show(false); - } - - public void show(boolean isEnrolling) { - if (!isEnrolling && (!mUpdateMonitor.isUnlockWithFingerprintPossible(KeyguardUpdateMonitor.getCurrentUser()) || - !mUpdateMonitor.isUnlockingWithFingerprintAllowed())) { - return; - } - if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; - - mParams.x = mX; - mParams.y = mY; - - mParams.height = mW; - mParams.width = mH; - mParams.format = PixelFormat.TRANSLUCENT; - - mParams.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; - mParams.setTitle("Fingerprint on display"); - mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | - WindowManager.LayoutParams.FLAG_DIM_BEHIND | - WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; - mParams.dimAmount = UNTOUCHED_DIM; - - mParams.packageName = "android"; - - setImageResource(R.drawable.fod_icon_default); - mIsEnrolling = isEnrolling; - if (mIsEnrolling) { - try { - mDisplayDaemon.setMode(DISPLAY_SET_DIM, 1); - } catch (RemoteException e) {} - } - mParams.gravity = Gravity.TOP | Gravity.LEFT; - mWM.addView(this, mParams); - viewAdded = true; - mChange = true; - } - - public void hide() { - if(mX == -1 || mY == -1 || mW == -1 || mH == -1) return; - - try { - mDisplayDaemon.setMode(DISPLAY_AOD_MODE, 0); - mDisplayDaemon.setMode(DISPLAY_NOTIFY_PRESS, 0); - } catch (RemoteException e) {} - if (mIsEnrolling) { - try { - mDisplayDaemon.setMode(DISPLAY_SET_DIM, 0); - } catch (RemoteException e) {} - } - mInsideCircle = false; - mWM.removeView(this); - viewAdded = false; - } -} diff --git a/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleViewImpl.java b/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleViewImpl.java deleted file mode 100644 index c432d3c0266..00000000000 --- a/packages/SystemUI/src/com/android/systemui/fingerprint/FODCircleViewImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (C) 2019 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.systemui.fingerprint; - -import android.content.pm.PackageManager; -import android.util.Log; -import android.view.View; - -import com.android.systemui.SystemUI; -import com.android.systemui.statusbar.CommandQueue; -import com.android.systemui.statusbar.CommandQueue.Callbacks; - -public class FODCircleViewImpl extends SystemUI implements CommandQueue.Callbacks { - private static final String TAG = "FODCircleViewImpl"; - private FODCircleView mfodCircleView; - - - @Override - public void start() { - if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) { - return; - } - getComponent(CommandQueue.class).addCallbacks(this); - } - - @Override - public void handleInDisplayFingerprintView(boolean show, boolean isEnrolling) { - if (mfodCircleView == null) - mfodCircleView = new FODCircleView(mContext); - if (!mfodCircleView.viewAdded && show) - mfodCircleView.show(isEnrolling); - else if (mfodCircleView.viewAdded) - mfodCircleView.hide(); - } -} - diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 8e8cdb46d90..f8d5cb19a3d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -2262,23 +2262,5 @@ public IKeyguardDismissCallback getCallback() { public CharSequence getMessage() { return mMessage; } - } - - public void refreshSounds() { - ContentResolver cr = mContext.getContentResolver(); - String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND); - if (soundPath != null) { - mLockSoundId = mLockSounds.load(soundPath, 1); - } - if (soundPath == null || mLockSoundId == 0) { - Log.w(TAG, "failed to load lock sound from " + soundPath); - } - soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND); - if (soundPath != null) { - mUnlockSoundId = mLockSounds.load(soundPath, 1); - } - if (soundPath == null || mUnlockSoundId == 0) { - Log.w(TAG, "failed to load unlock sound from " + soundPath); - } } } diff --git a/packages/SystemUI/src/com/android/systemui/omni/BatteryBarView.java b/packages/SystemUI/src/com/android/systemui/omni/BatteryBarView.java new file mode 100644 index 00000000000..c6d645d21f1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/omni/BatteryBarView.java @@ -0,0 +1,96 @@ +/* +* Copyright (C) 2019 The OmniROM Project +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +*/ +package com.android.systemui.omni; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.drawable.GradientDrawable; +import android.util.AttributeSet; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; + +import com.android.systemui.R; + +public class BatteryBarView extends LinearLayout { + private ImageView mBarForground; + private int mMaxWidth; + private int mCurrentWidth; + private boolean mInitDone; + private int mPercent; + + private Runnable mBarUpdate = new Runnable() { + @Override + public void run() { + mCurrentWidth = (mMaxWidth / 100) * mPercent; + ViewGroup.LayoutParams barParams = mBarForground.getLayoutParams(); + barParams.width = mCurrentWidth; + mBarForground.setLayoutParams(barParams); + } + }; + public BatteryBarView(Context context) { + this(context, null); + } + + public BatteryBarView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public BatteryBarView(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, 0); + } + + public BatteryBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + mBarForground = findViewById(R.id.battery_bar_view_fg); + mInitDone = false; + } + + public void setBatteryPercent(int percent) { + mPercent = percent; + if (mMaxWidth != 0) { + mInitDone = true; + post(mBarUpdate); + } + } + + public void setBarColor(int color) { + GradientDrawable fg = (GradientDrawable) mBarForground.getDrawable(); + fg.setColor(color); + GradientDrawable bg = (GradientDrawable) getBackground(); + bg.setColor(color); + bg.setAlpha(128); + } + + @Override + public void draw(Canvas canvas) { + super.draw(canvas); + mMaxWidth = getWidth(); + if (!mInitDone) { + mInitDone = true; + post(mBarUpdate); + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/SoundTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/SoundTile.java index 29c53adb180..62ff9ce6736 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/SoundTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/SoundTile.java @@ -128,18 +128,21 @@ protected void handleUpdateState(BooleanState state, Object arg) { state.label = mContext.getString(R.string.quick_settings_sound_ring); state.contentDescription = mContext.getString( R.string.quick_settings_sound_ring); + state.state = Tile.STATE_INACTIVE; break; case AudioManager.RINGER_MODE_VIBRATE: state.icon = ResourceIcon.get(R.drawable.ic_qs_ringer_vibrate); state.label = mContext.getString(R.string.quick_settings_sound_vibrate); state.contentDescription = mContext.getString( R.string.quick_settings_sound_vibrate); + state.state = Tile.STATE_ACTIVE; break; case AudioManager.RINGER_MODE_SILENT: state.icon = ResourceIcon.get(R.drawable.ic_qs_ringer_silent); state.label = mContext.getString(R.string.quick_settings_sound_dnd); state.contentDescription = mContext.getString( R.string.quick_settings_sound_dnd); + state.state = Tile.STATE_ACTIVE; break; default: break; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 7457ab82407..20c4d2c6534 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -103,7 +103,6 @@ public class CommandQueue extends IStatusBar.Stub { private static final int MSG_TOGGLE_FLASHLIGHT = 53 << MSG_SHIFT; private static final int MSG_TOGGLE_NAVIGATION_EDITOR = 54 << MSG_SHIFT; private static final int MSG_DISPATCH_NAVIGATION_EDITOR_RESULTS = 55 << MSG_SHIFT; - private static final int MSG_IN_DISPLAY_FINGERPRINT = 56 << MSG_SHIFT; public static final int FLAG_EXCLUDE_NONE = 0; public static final int FLAG_EXCLUDE_SEARCH_PANEL = 1 << 0; @@ -176,7 +175,6 @@ default void onFingerprintAuthenticated() { } default void onFingerprintHelp(String message) { } default void onFingerprintError(String error) { } default void hideFingerprintDialog() { } - default void handleInDisplayFingerprintView(boolean show, boolean isEnrolling) { } default void toggleCameraFlash() { } default void setAutoRotate(boolean enabled) { } default void restartUI() { } @@ -617,17 +615,6 @@ public void hideFingerprintDialog() { } } - @Override - public void handleInDisplayFingerprintView(boolean show, boolean isEnrolling) { - synchronized (mLock) { - SomeArgs args = SomeArgs.obtain(); - args.arg1 = show; - args.arg2 = isEnrolling; - mHandler.obtainMessage(MSG_IN_DISPLAY_FINGERPRINT, args) - .sendToTarget(); - } - } - @Override public void toggleCameraFlash() { synchronized (mLock) { @@ -882,14 +869,6 @@ public void handleMessage(Message msg) { for (int i = 0; i < mCallbacks.size(); i++) { mCallbacks.get(i).hideFingerprintDialog(); } - break; - case MSG_IN_DISPLAY_FINGERPRINT: - for (int i = 0; i < mCallbacks.size(); i++) { - mCallbacks.get(i).handleInDisplayFingerprintView( - (boolean)((SomeArgs)msg.obj).arg1, - (boolean)((SomeArgs)msg.obj).arg2); - } - break; case MSG_SHOW_CHARGING_ANIMATION: for (int i = 0; i < mCallbacks.size(); i++) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 9fbab5d64f6..0c277d85697 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -50,10 +50,12 @@ import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; +import com.android.systemui.omni.BatteryBarView; import com.android.systemui.statusbar.phone.KeyguardIndicationTextView; import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import com.android.systemui.statusbar.policy.UserInfoController; +import com.android.systemui.tuner.TunerService; import com.android.systemui.util.wakelock.SettableWakeLock; import com.android.systemui.util.wakelock.WakeLock; @@ -70,7 +72,6 @@ public class KeyguardIndicationController { private static final String TAG = "KeyguardIndication"; - private static final boolean DEBUG_CHARGING_SPEED = false; private static final int MSG_HIDE_TRANSIENT = 1; private static final int MSG_CLEAR_FP_MSG = 2; @@ -113,6 +114,14 @@ public class KeyguardIndicationController { private final DevicePolicyManager mDevicePolicyManager; private boolean mDozing; + // omni additions + private static final String KEYGUARD_SHOW_WATT_ON_CHARGING = "sysui_keyguard_show_watt"; + private static final String KEYGUARD_SHOW_BATTERY_BAR = "sysui_keyguard_show_battery_bar"; + private static final String KEYGUARD_SHOW_BATTERY_BAR_ALWAYS = "sysui_keyguard_show_battery_bar_always"; + + private BatteryBarView mBatteryBar; + + /** * Creates a new KeyguardIndicationController and registers callbacks. */ @@ -151,6 +160,8 @@ public KeyguardIndicationController(Context context, ViewGroup indicationArea, mDevicePolicyManager = (DevicePolicyManager) context.getSystemService( Context.DEVICE_POLICY_SERVICE); + mBatteryBar = indicationArea.findViewById(R.id.battery_bar_view); + updateDisclosure(); } @@ -311,8 +322,16 @@ protected final void updateIndication(boolean animate) { } if (isReallyVisible()) { + final boolean showWattOnCharging = Dependency.get(TunerService.class) + .getValue(KEYGUARD_SHOW_WATT_ON_CHARGING, 0) == 1; + final boolean showBatteryBar = Dependency.get(TunerService.class) + .getValue(KEYGUARD_SHOW_BATTERY_BAR, 0) == 1; + final boolean showBatteryBarAlways = Dependency.get(TunerService.class) + .getValue(KEYGUARD_SHOW_BATTERY_BAR_ALWAYS, 0) == 1; + // Walk down a precedence-ordered list of what indication // should be shown based on user or device state + mBatteryBar.setVisibility(View.GONE); if (mDozing) { mTextView.setTextColor(Color.WHITE); if (!TextUtils.isEmpty(mTransientIndication)) { @@ -321,11 +340,19 @@ protected final void updateIndication(boolean animate) { mTextView.switchIndication(mTransientIndication); } else if (mPowerPluggedIn) { String indication = computePowerIndication(); + if (showWattOnCharging) { + indication += ", " + (mChargingWattage / 1000) + " mW"; + } if (animate) { animateText(mTextView, indication); } else { mTextView.switchIndication(indication); } + if (showBatteryBar) { + mBatteryBar.setVisibility(View.VISIBLE); + mBatteryBar.setBatteryPercent(mBatteryLevel); + mBatteryBar.setBarColor(Color.WHITE); + } } else { // Use the high voltage symbol ⚡ (u26A1 unicode) but prevent the system // to load its emoji colored variant with the uFE0E flag @@ -363,7 +390,7 @@ protected final void updateIndication(boolean animate) { mTextView.setTextColor(mInitialTextColor); } else if (mPowerPluggedIn) { String indication = computePowerIndication(); - if (DEBUG_CHARGING_SPEED) { + if (showWattOnCharging) { indication += ", " + (mChargingWattage / 1000) + " mW"; } mTextView.setTextColor(mInitialTextColor); @@ -372,6 +399,11 @@ protected final void updateIndication(boolean animate) { } else { mTextView.switchIndication(indication); } + if (showBatteryBar && showBatteryBarAlways) { + mBatteryBar.setVisibility(View.VISIBLE); + mBatteryBar.setBatteryPercent(mBatteryLevel); + mBatteryBar.setBarColor(mInitialTextColor); + } } else if (!TextUtils.isEmpty(trustManagedIndication) && updateMonitor.getUserTrustIsManaged(userId) && !updateMonitor.getUserHasTrust(userId)) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java index 0eae8ce29d7..5b3940dbf0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java @@ -443,6 +443,8 @@ private void setCarrierLabel(boolean animate) { } public void updateLogoSettings(boolean animate) { + if (getContext() == null) + return; mShowLogo = Settings.System.getIntForUser( getContext().getContentResolver(), Settings.System.STATUS_BAR_LOGO, 0, UserHandle.USER_CURRENT) == 1; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java index de2c6ee1c6c..e0fee8d6c5a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java @@ -58,8 +58,6 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange private boolean mHasFaceUnlockIcon; private int mDensity; - private boolean mDisplayFODView; - private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */); public LockIcon(Context context, AttributeSet attrs) { @@ -67,9 +65,6 @@ public LockIcon(Context context, AttributeSet attrs) { mTrustDrawable = new TrustDrawable(context); setBackground(mTrustDrawable); mUnlockMethodCache = UnlockMethodCache.getInstance(context); - mDisplayFODView = context.getResources() - .getBoolean(com.android.internal.R.bool.config_needCustomFODView); - } @Override @@ -307,13 +302,13 @@ private int getState() { KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning(); boolean unlockingAllowed = updateMonitor.isUnlockingWithFingerprintAllowed(); - if (mTransientFpError && !mDisplayFODView) { + if (mTransientFpError) { return STATE_FINGERPRINT_ERROR; } else if (mUnlockMethodCache.canSkipBouncer()) { return STATE_LOCK_OPEN; } else if (mUnlockMethodCache.isFaceUnlockRunning()) { return STATE_FACE_UNLOCK; - } else if (fingerprintRunning && unlockingAllowed && !mDisplayFODView) { + } else if (fingerprintRunning && unlockingAllowed) { return STATE_FINGERPRINT; } else { return STATE_LOCKED; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index a25e79f3d78..1719585ed41 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -6120,14 +6120,14 @@ public void onPulseStarted() { // Otherwise just show the always-on screen. setPulsing(true); } - KeyguardUpdateMonitor.getInstance(mContext).setPulsing(true); + setOnPulseEvent(reason, true); } @Override public void onPulseFinished() { callback.onPulseFinished(); setPulsing(false); - KeyguardUpdateMonitor.getInstance(mContext).setPulsing(false); + setOnPulseEvent(-1, false); } private void setPulsing(boolean pulsing) { diff --git a/services/core/Android.bp b/services/core/Android.bp index dd7996d3065..d6cde0353bd 100644 --- a/services/core/Android.bp +++ b/services/core/Android.bp @@ -44,8 +44,6 @@ java_library_static { "android.hardware.vibrator-V1.0-java", "android.hardware.configstore-V1.0-java", "android.hardware.contexthub-V1.0-java", - "vendor.oneplus.fingerprint.extension-V1.0-java", - "vendor.oneplus.hardware.display-V1.0-java", ], } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 2a03c85764e..8dee587e045 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -283,8 +283,6 @@ import android.content.IIntentSender; import android.content.Intent; import android.content.IntentFilter; -import android.content.om.IOverlayManager; -import android.content.om.OverlayInfo; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo.HiddenApiEnforcementPolicy; @@ -15014,34 +15012,6 @@ public final void showSafeModeOverlay() { Context.WINDOW_SERVICE)).addView(v, lp); } - public final void disableOverlays() { - try { - IOverlayManager iom = IOverlayManager.Stub.asInterface( - ServiceManager.getService("overlay")); - if (iom == null) { - return; - } - Log.d(TAG, "Contacting the Overlay Manager Service for the list of enabled overlays"); - Map> allOverlays = iom.getAllOverlays(UserHandle.USER_SYSTEM); - if (allOverlays != null) { - Log.d(TAG, "The Overlay Manager Service provided the list of enabled overlays"); - Set set = allOverlays.keySet(); - for (String targetPackageName : set) { - for (OverlayInfo oi : allOverlays.get(targetPackageName)) { - if (oi.isEnabled()) { - iom.setEnabled(oi.packageName, false, UserHandle.USER_SYSTEM); - Log.d(TAG, "Now disabling \'" + oi.packageName + "\'"); - } - } - } - } - } catch (RemoteException re) { - re.printStackTrace(); - Log.d(TAG, "RemoteException while trying to contact the Overlay Manager Service!"); - } - } - - @Override public void noteWakeupAlarm(IIntentSender sender, WorkSource workSource, int sourceUid, String sourcePkg, String tag) { diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java index db0b5de9cea..cf3b68e6e59 100644 --- a/services/core/java/com/android/server/am/AppErrors.java +++ b/services/core/java/com/android/server/am/AppErrors.java @@ -459,14 +459,6 @@ void crashApplicationInner(ProcessRecord r, ApplicationErrorReport.CrashInfo cra task = data.task; msg.obj = data; mService.mUiHandler.sendMessage(msg); - - // Send broadcast intent to alert Substratum - Intent intent = new Intent("projekt.substratum.APP_CRASHED"); - intent.putExtra("projekt.substratum.EXTRA_PACKAGE_NAME", r.info.packageName); - intent.putExtra("projekt.substratum.EXTRA_CRASH_REPEATING", data.repeating); - intent.putExtra("projekt.substratum.EXTRA_EXCEPTION_CLASS_NAME", - crashInfo.exceptionClassName); - mContext.sendBroadcast(intent); } int res = result.get(); diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index 07b46ddcf86..25c8c31d4de 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -299,7 +299,6 @@ private boolean isPlatformAutomotive() { /* Sound effect file names */ private static final String SOUND_EFFECTS_PATH = "/media/audio/ui/"; - private static final String SOUND_EFFECTS_THEMED_PATH = "/data/system/theme/audio/ui/"; private static final List SOUND_EFFECT_FILES = new ArrayList(); /* Sound effect file name mapping sound effect id (AudioManager.FX_xxx) to @@ -5460,15 +5459,11 @@ private void persistRingerMode(int ringerMode) { } private String getSoundEffectFilePath(int effectType) { - String filePath = SOUND_EFFECTS_THEMED_PATH + - SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effectType][0]); + String filePath = Environment.getProductDirectory() + SOUND_EFFECTS_PATH + + SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effectType][0]); if (!new File(filePath).isFile()) { - filePath = Environment.getProductDirectory() + SOUND_EFFECTS_PATH + filePath = Environment.getRootDirectory() + SOUND_EFFECTS_PATH + SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effectType][0]); - if (!new File(filePath).isFile()) { - filePath = Environment.getRootDirectory() + SOUND_EFFECTS_PATH - + SOUND_EFFECT_FILES.get(SOUND_EFFECT_FILES_MAP[effectType][0]); - } } return filePath; } diff --git a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java index b9e376271fa..afd1a94bf50 100644 --- a/services/core/java/com/android/server/fingerprint/AuthenticationClient.java +++ b/services/core/java/com/android/server/fingerprint/AuthenticationClient.java @@ -17,8 +17,6 @@ package com.android.server.fingerprint; import android.content.Context; -import android.content.ComponentName; -import android.content.res.Resources; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.IBiometricPromptReceiver; @@ -28,15 +26,12 @@ import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; -import android.content.pm.PackageManager; import android.util.Slog; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; -import vendor.oneplus.fingerprint.extension.V1_0.IVendorFingerprintExtensions; - /** * A class to keep track of the authentication state for a given client. */ @@ -59,12 +54,6 @@ public abstract class AuthenticationClient extends ClientMonitor { private final FingerprintManager mFingerprintManager; protected boolean mDialogDismissed; - private boolean mDisplayFODView; - private IVendorFingerprintExtensions mExtDaemon = null; - private final String mKeyguardPackage; - private static final int DISABLE_FP_LONGPRESS = 4; - private static final int ENABLE_FP_LONGPRESS = 3; - // Receives events from SystemUI and handles them before forwarding them to FingerprintDialog protected IBiometricPromptReceiver mDialogReceiver = new IBiometricPromptReceiver.Stub() { @Override // binder call @@ -107,9 +96,6 @@ public AuthenticationClient(Context context, long halDeviceId, IBinder token, mStatusBarService = statusBarService; mFingerprintManager = (FingerprintManager) getContext() .getSystemService(Context.FINGERPRINT_SERVICE); - mDisplayFODView = context.getResources().getBoolean(com.android.internal.R.bool.config_needCustomFODView); - mKeyguardPackage = ComponentName.unflattenFromString(context.getResources().getString( - com.android.internal.R.string.config_keyguardComponent)).getPackageName(); } @Override @@ -247,11 +233,6 @@ public boolean onAuthenticated(int fingerId, int groupId) { resetFailedAttempts(); onStop(); } - if(result == true && mDisplayFODView) { - try { - mStatusBarService.handleInDisplayFingerprintView(false, false); - } catch (RemoteException e) {} - } return result; } @@ -265,21 +246,6 @@ public int start() { Slog.w(TAG, "start authentication: no fingerprint HAL!"); return ERROR_ESRCH; } - - if (mDisplayFODView) { - try { - mExtDaemon = IVendorFingerprintExtensions.getService(); - Slog.w(TAG, "getOwnerString : " + isKeyguard(getOwnerString())); - - if (isKeyguard(getOwnerString())) { - mExtDaemon.updateStatus(ENABLE_FP_LONGPRESS); - } else { - mExtDaemon.updateStatus(DISABLE_FP_LONGPRESS); - } - - mStatusBarService.handleInDisplayFingerprintView(true, false); - } catch (RemoteException e) {} - } onStart(); try { final int result = daemon.authenticate(mOpId, getGroupId()); @@ -292,7 +258,7 @@ public int start() { if (DEBUG) Slog.w(TAG, "client " + getOwnerString() + " is authenticating..."); // If authenticating with system dialog, show the dialog - if (!mDisplayFODView && mBundle != null) { + if (mBundle != null) { try { mStatusBarService.showFingerprintDialog(mBundle, mDialogReceiver); } catch (RemoteException e) { @@ -306,14 +272,6 @@ public int start() { return 0; // success } - /** - * @param clientPackage - * @return true if this is keyguard package - */ - private boolean isKeyguard(String clientPackage) { - return mKeyguardPackage.equals(clientPackage); - } - @Override public int stop(boolean initiatedByClient) { if (mAlreadyCancelled) { @@ -321,12 +279,6 @@ public int stop(boolean initiatedByClient) { return 0; } - if (mDisplayFODView) { - try { - mStatusBarService.handleInDisplayFingerprintView(false, false); - } catch (RemoteException e) {} - } - onStop(); IBiometricsFingerprint daemon = getFingerprintDaemon(); if (daemon == null) { @@ -348,7 +300,7 @@ public int stop(boolean initiatedByClient) { // dialog, we do not need to hide it since it's already hidden. // If the device is in lockout, don't hide the dialog - it will automatically hide // after BiometricPrompt.HIDE_DIALOG_DELAY - if (!mDisplayFODView && mBundle != null && !mDialogDismissed && !mInLockout) { + if (mBundle != null && !mDialogDismissed && !mInLockout) { try { mStatusBarService.hideFingerprintDialog(); } catch (RemoteException e) { diff --git a/services/core/java/com/android/server/fingerprint/EnrollClient.java b/services/core/java/com/android/server/fingerprint/EnrollClient.java index 6b78a9ff67b..c9efcf2fd68 100644 --- a/services/core/java/com/android/server/fingerprint/EnrollClient.java +++ b/services/core/java/com/android/server/fingerprint/EnrollClient.java @@ -17,7 +17,6 @@ package com.android.server.fingerprint; import android.content.Context; -import android.content.res.Resources; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.IFingerprintServiceReceiver; @@ -27,12 +26,9 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; -import com.android.internal.statusbar.IStatusBarService; import java.util.Arrays; -import vendor.oneplus.fingerprint.extension.V1_0.IVendorFingerprintExtensions; - /** * A class to keep track of the enrollment state for a given client. */ @@ -40,20 +36,12 @@ public abstract class EnrollClient extends ClientMonitor { private static final long MS_PER_SEC = 1000; private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute private byte[] mCryptoToken; - private boolean mDisplayFODView; - private IStatusBarService mStatusBarService; - private IVendorFingerprintExtensions mExtDaemon = null; - private static final int DISABLE_FP_LONGPRESS = 4; - private static final int RESUME_FP_ENROLL = 8; - private static final int FINISH_FP_ENROLL = 10; public EnrollClient(Context context, long halDeviceId, IBinder token, IFingerprintServiceReceiver receiver, int userId, int groupId, byte [] cryptoToken, - boolean restricted, String owner, IStatusBarService statusBarService) { + boolean restricted, String owner) { super(context, halDeviceId, token, receiver, userId, groupId, restricted, owner); mCryptoToken = Arrays.copyOf(cryptoToken, cryptoToken.length); - mDisplayFODView = context.getResources().getBoolean(com.android.internal.R.bool.config_needCustomFODView); - mStatusBarService = statusBarService; } @Override @@ -81,13 +69,6 @@ private boolean sendEnrollResult(int fpId, int groupId, int remaining) { MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_ENROLL); try { receiver.onEnrollResult(getHalDeviceId(), fpId, groupId, remaining); - if(remaining == 0 && mDisplayFODView) { - try { - mExtDaemon = IVendorFingerprintExtensions.getService(); - mExtDaemon.updateStatus(FINISH_FP_ENROLL); - mStatusBarService.handleInDisplayFingerprintView(false, true); - } catch (RemoteException e) {} - } return remaining == 0; } catch (RemoteException e) { Slog.w(TAG, "Failed to notify EnrollResult:", e); @@ -102,17 +83,6 @@ public int start() { Slog.w(TAG, "enroll: no fingerprint HAL!"); return ERROR_ESRCH; } - Slog.w(TAG, "Starting enroll"); - - if (mDisplayFODView) { - try { - mExtDaemon = IVendorFingerprintExtensions.getService(); - mExtDaemon.updateStatus(RESUME_FP_ENROLL); - mStatusBarService.handleInDisplayFingerprintView(true, true); - mExtDaemon.updateStatus(DISABLE_FP_LONGPRESS); - } catch (RemoteException e) {} - } - final int timeout = (int) (ENROLLMENT_TIMEOUT_MS / MS_PER_SEC); try { final int result = daemon.enroll(mCryptoToken, getGroupId(), timeout); @@ -134,13 +104,6 @@ public int stop(boolean initiatedByClient) { Slog.w(TAG, "stopEnroll: already cancelled!"); return 0; } - - if (mDisplayFODView) { - try { - mStatusBarService.handleInDisplayFingerprintView(false, true); - } catch (RemoteException e) {} - } - IBiometricsFingerprint daemon = getFingerprintDaemon(); if (daemon == null) { Slog.w(TAG, "stopEnrollment: no fingerprint HAL!"); diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java index 9a2a284a66f..b4e137783ec 100644 --- a/services/core/java/com/android/server/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java @@ -38,7 +38,6 @@ import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.UserInfo; -import android.content.res.Resources; import android.hardware.biometrics.IBiometricPromptReceiver; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprintClientCallback; @@ -152,8 +151,6 @@ private class PerformanceStats { private IBinder mToken = new Binder(); // used for internal FingerprintService enumeration private ArrayList mUnknownFingerprints = new ArrayList<>(); // hw fingerprints - private boolean mUsesOnePlusFOD; - private class UserFingerprint { Fingerprint f; int userId; @@ -269,7 +266,6 @@ public FingerprintService(Context context) { com.android.internal.R.bool.config_notifyClientOnFingerprintCancelSuccess); mCleanupUnusedFingerprints = mContext.getResources().getBoolean( com.android.internal.R.bool.config_cleanupUnusedFingerprints); - mUsesOnePlusFOD = context.getResources().getBoolean(com.android.internal.R.bool.config_usesOnePlusFOD); } @Override @@ -401,10 +397,6 @@ protected void handleEnumerate(long deviceId, int fingerId, int groupId, int rem } protected void handleError(long deviceId, int error, int vendorCode) { - - if (mUsesOnePlusFOD && error == 8) - return; - ClientMonitor client = mCurrentClient; if (client instanceof InternalRemovalClient || client instanceof InternalEnumerateClient) { clearEnumerateState(); @@ -963,7 +955,7 @@ private void startEnrollment(IBinder token, byte [] cryptoToken, int userId, final int groupId = userId; // default group for fingerprint enrollment EnrollClient client = new EnrollClient(getContext(), mHalDeviceId, token, receiver, - userId, groupId, cryptoToken, restricted, opPackageName, mStatusBarService) { + userId, groupId, cryptoToken, restricted, opPackageName) { @Override public IBiometricsFingerprint getFingerprintDaemon() { diff --git a/services/core/java/com/android/server/om/OverlayManagerService.java b/services/core/java/com/android/server/om/OverlayManagerService.java index 0a82f9349ba..c7387018900 100644 --- a/services/core/java/com/android/server/om/OverlayManagerService.java +++ b/services/core/java/com/android/server/om/OverlayManagerService.java @@ -539,6 +539,7 @@ public OverlayInfo getOverlayInfo(@Nullable final String packageName, @Override public boolean setEnabled(@Nullable final String packageName, final boolean enable, int userId) throws RemoteException { + enforceChangeOverlayPackagesPermission("setEnabled"); userId = handleIncomingUser(userId, "setEnabled"); if (packageName == null) { return false; @@ -557,6 +558,7 @@ public boolean setEnabled(@Nullable final String packageName, final boolean enab @Override public boolean setEnabledExclusive(@Nullable final String packageName, final boolean enable, int userId) throws RemoteException { + enforceChangeOverlayPackagesPermission("setEnabled"); userId = handleIncomingUser(userId, "setEnabled"); if (packageName == null || !enable) { return false; diff --git a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java index 380ba5cd0dc..112059daf95 100644 --- a/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java +++ b/services/core/java/com/android/server/om/OverlayManagerServiceImpl.java @@ -21,7 +21,6 @@ import static android.content.om.OverlayInfo.STATE_ENABLED_STATIC; import static android.content.om.OverlayInfo.STATE_MISSING_TARGET; import static android.content.om.OverlayInfo.STATE_NO_IDMAP; -import static android.content.om.OverlayInfo.STATE_OVERLAY_NOT_AVAILABLE; import static android.content.om.OverlayInfo.STATE_OVERLAY_UPGRADING; import static android.content.om.OverlayInfo.STATE_TARGET_UPGRADING; @@ -314,9 +313,7 @@ private boolean updateAllOverlaysForTarget(@NonNull final String targetPackageNa } // check for enabled framework overlays - if (!"android".equals(targetPackageName)) { - modified = modified || !getEnabledOverlayPackageNames("android", userId).isEmpty(); - } + modified = modified || !getEnabledOverlayPackageNames("android", userId).isEmpty(); return modified; } @@ -685,14 +682,6 @@ private boolean updateState(@NonNull final String targetPackageName, return STATE_MISSING_TARGET; } - if (!targetPackage.applicationInfo.enabled) { - return STATE_MISSING_TARGET; - } - - if (!overlayPackage.applicationInfo.enabled) { - return STATE_OVERLAY_NOT_AVAILABLE; - } - if (!mIdmapManager.idmapExists(overlayPackage, userId)) { return STATE_NO_IDMAP; } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 015f5d48cef..95ad9c44724 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -476,7 +476,6 @@ public class PackageManagerService extends IPackageManager.Stub static final int SCAN_AS_OEM = 1<<19; static final int SCAN_AS_VENDOR = 1<<20; static final int SCAN_AS_PRODUCT = 1<<21; - static final int SCAN_AS_THEME = 1<<22; @IntDef(flag = true, prefix = { "SCAN_" }, value = { SCAN_NO_DEX, @@ -585,8 +584,6 @@ public class PackageManagerService extends IPackageManager.Stub private static final String PRODUCT_OVERLAY_DIR = "/product/overlay"; - private static final String THEME_OVERLAY_DIR = "/data/system/theme"; - /** Canonical intent used to identify what counts as a "web browser" app */ private static final Intent sBrowserIntent; static { @@ -2656,15 +2653,6 @@ public void onDefaultRuntimePermissionsGranted(int userId) { | SCAN_AS_SYSTEM | SCAN_AS_PRODUCT, 0); - scanDirTracedLI(new File(THEME_OVERLAY_DIR), - mDefParseFlags - | PackageParser.PARSE_IS_SYSTEM_DIR, - scanFlags - | SCAN_AS_SYSTEM - | SCAN_AS_PRODUCT - | SCAN_AS_THEME, - 0); - mParallelPackageParserCallback.findStaticOverlayPackages(); @@ -11403,26 +11391,16 @@ private void assertPackageIsValid(PackageParser.Package pkg, final @ParseFlags i } // The only case where we allow installation of a non-system overlay is when - // its signature is signed with a whitelisted OEM theme system certificate. - ArraySet wlSigApps = - SystemConfig.getInstance().getThemeSystemSignatureWhitelistedApps(); - boolean sigAllowed = false; - for (String pkgName : wlSigApps) { - PackageSetting platformPkgSetting = mSettings.getPackageLPr(pkgName); - sigAllowed = (platformPkgSetting.signatures.mSigningDetails - != PackageParser.SigningDetails.UNKNOWN) - && (compareSignatures( - platformPkgSetting.signatures.mSigningDetails.signatures, - pkg.mSigningDetails.signatures) - == PackageManager.SIGNATURE_MATCH); - if (sigAllowed) { - break; - } - } - - if (!sigAllowed) { + // its signature is signed with the platform certificate. + PackageSetting platformPkgSetting = mSettings.getPackageLPr("android"); + if ((platformPkgSetting.signatures.mSigningDetails + != PackageParser.SigningDetails.UNKNOWN) + && (compareSignatures( + platformPkgSetting.signatures.mSigningDetails.signatures, + pkg.mSigningDetails.signatures) + != PackageManager.SIGNATURE_MATCH)) { throw new PackageManagerException("Overlay " + pkg.packageName + - " must be signed with a whitelisted OEM theme system certificate."); + " must be signed with the platform certificate."); } } } diff --git a/services/core/java/com/android/server/power/ShutdownThread.java b/services/core/java/com/android/server/power/ShutdownThread.java index ac93540c3c7..1401cb38033 100644 --- a/services/core/java/com/android/server/power/ShutdownThread.java +++ b/services/core/java/com/android/server/power/ShutdownThread.java @@ -485,7 +485,7 @@ private static ProgressDialog showShutdownDialog(Context context) { break; } - if (!themeShutdownAnimationExists()) pd.show(); + pd.show(); return pd; } @@ -589,10 +589,6 @@ public void run() { SystemProperties.set(SHUTDOWN_ACTION_PROPERTY, reason); } - if (themeShutdownAnimationExists()) { - startShutdownAnimation(); - } - /* * If we are rebooting into safe mode, write a system property * indicating so. @@ -813,7 +809,6 @@ public void run() { */ public static void rebootOrShutdown(final Context context, boolean reboot, String reason) { if (reboot) { - stopShutdownAnimation(); Log.i(TAG, "Rebooting, reason: " + reason); PowerManagerService.lowLevelReboot(reason); Log.e(TAG, "Reboot failed, will attempt shutdown instead"); @@ -834,9 +829,6 @@ public static void rebootOrShutdown(final Context context, boolean reboot, Strin } catch (InterruptedException unused) { } } - - stopShutdownAnimation(); - // Shutdown power Log.i(TAG, "Performing low-level shutdown..."); PowerManagerService.lowLevelShutdown(reason); @@ -929,24 +921,4 @@ public void run() { } } } - - private static boolean themeShutdownAnimationExists() { - return new File("/data/system/theme/shutdownanimation.zip").exists(); - } - - private static void startShutdownAnimation() { - SystemProperties.set("service.bootanim.exit", "0"); - SystemProperties.set("sys.powerctl", "animate"); - SystemProperties.set("ctl.start", "bootanim"); - } - - private static void stopShutdownAnimation() { - SystemProperties.set("service.bootanim.exit", "1"); - while (SystemProperties.get("init.svc.bootanim").equals("running")) { - try { - Thread.sleep(10); - } catch (InterruptedException unused) { - } - } - } } diff --git a/services/core/java/com/android/server/slice/SliceManagerService.java b/services/core/java/com/android/server/slice/SliceManagerService.java index e8f255f4dfc..f5947ee35ea 100644 --- a/services/core/java/com/android/server/slice/SliceManagerService.java +++ b/services/core/java/com/android/server/slice/SliceManagerService.java @@ -390,7 +390,7 @@ public Handler getHandler() { } protected int checkAccess(String pkg, Uri uri, int uid, int pid) { - return checkSlicePermission(uri, pkg, uid, pid, null); + return checkSlicePermission(uri, pkg, pid, uid, null); } private String getProviderPkg(Uri uri, int user) { diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 9e82de52711..c1e64899a5c 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -754,15 +754,6 @@ public void hideFingerprintDialog() { } } - @Override - public void handleInDisplayFingerprintView(boolean show, boolean isEnrolling) { - if (mBar != null) { - try { - mBar.handleInDisplayFingerprintView(show, isEnrolling); - } catch (RemoteException ex) {} - } - } - @Override public void toggleCameraFlash() { if (mBar != null) { diff --git a/services/core/java/com/android/server/substratum/SoundUtils.java b/services/core/java/com/android/server/substratum/SoundUtils.java deleted file mode 100644 index 4b0acbf4332..00000000000 --- a/services/core/java/com/android/server/substratum/SoundUtils.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Substratum - * - * 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.server.substratum; - -import android.content.ContentResolver; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteConstraintException; -import android.media.RingtoneManager; -import android.net.Uri; -import android.os.SystemProperties; -import android.os.UserHandle; -import android.provider.MediaStore; -import android.provider.Settings; -import android.util.Log; - -import java.io.File; -import java.util.Arrays; - -public class SoundUtils { - private static final String TAG = "SubstratumService"; - private static final String SYSTEM_MEDIA_PATH = "/system/media/audio"; - private static final String SYSTEM_ALARMS_PATH = - SYSTEM_MEDIA_PATH + File.separator + "alarms"; - private static final String SYSTEM_RINGTONES_PATH = - SYSTEM_MEDIA_PATH + File.separator + "ringtones"; - private static final String SYSTEM_NOTIFICATIONS_PATH = - SYSTEM_MEDIA_PATH + File.separator + "notifications"; - private static final String MEDIA_CONTENT_URI = "content://media/internal/audio/media"; - - private static void updateGlobalSettings(ContentResolver resolver, String uri, String val) { - Settings.Global.putStringForUser(resolver, uri, val, UserHandle.USER_SYSTEM); - } - - public static boolean setUISounds(ContentResolver resolver, String sound_name, - String location) { - if (allowedUISound(sound_name)) { - updateGlobalSettings(resolver, sound_name, location); - return true; - } - - return false; - } - - public static void setDefaultUISounds(ContentResolver resolver, String sound_name, - String sound_file) { - updateGlobalSettings(resolver, sound_name, "/system/media/audio/ui/" + sound_file); - } - - // This string array contains all the SystemUI acceptable sound files - private static Boolean allowedUISound(String targetValue) { - String[] allowed_themable = { - "lock_sound", - "unlock_sound" - }; - - return Arrays.asList(allowed_themable).contains(targetValue); - } - - private static String getDefaultAudiblePath(int type) { - final String name; - final String path; - - switch (type) { - case RingtoneManager.TYPE_ALARM: - name = SystemProperties.get("ro.config.alarm_alert"); - path = name != null ? SYSTEM_ALARMS_PATH + File.separator + name : null; - break; - case RingtoneManager.TYPE_NOTIFICATION: - name = SystemProperties.get("ro.config.notification_sound"); - path = name != null ? SYSTEM_NOTIFICATIONS_PATH + File.separator + name : null; - break; - case RingtoneManager.TYPE_RINGTONE: - name = SystemProperties.get("ro.config.ringtone"); - path = name != null ? SYSTEM_RINGTONES_PATH + File.separator + name : null; - break; - default: - path = null; - break; - } - - return path; - } - - public static boolean setAudible(Context context, File ringtone, int type, String name) { - final String path = ringtone.getAbsolutePath(); - final String mimeType = name.endsWith(".ogg") ? "application/ogg" : "application/mp3"; - - ContentValues values = new ContentValues(); - values.put(MediaStore.MediaColumns.DATA, path); - values.put(MediaStore.MediaColumns.TITLE, name); - values.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); - values.put(MediaStore.MediaColumns.SIZE, ringtone.length()); - values.put(MediaStore.Audio.Media.IS_RINGTONE, type == RingtoneManager.TYPE_RINGTONE); - values.put(MediaStore.Audio.Media.IS_NOTIFICATION, - type == RingtoneManager.TYPE_NOTIFICATION); - values.put(MediaStore.Audio.Media.IS_ALARM, type == RingtoneManager.TYPE_ALARM); - values.put(MediaStore.Audio.Media.IS_MUSIC, false); - - Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); - Uri newUri = null; - Cursor c = context.getContentResolver().query(uri, - new String[]{ MediaStore.MediaColumns._ID }, - MediaStore.MediaColumns.DATA + "='" + path + "'", - null, null); - - if (c != null && c.getCount() > 0) { - c.moveToFirst(); - String id = String.valueOf(c.getLong(0)); - c.close(); - - newUri = Uri.withAppendedPath(Uri.parse(MEDIA_CONTENT_URI), id); - try { - context.getContentResolver().update(uri, values, - MediaStore.MediaColumns._ID + "=" + id, null); - } catch (SQLiteConstraintException e) { - // intentionally left empty - } - } - - if (newUri == null) { - newUri = context.getContentResolver().insert(uri, values); - } - - try { - RingtoneManager.setActualDefaultRingtoneUri(context, type, newUri); - } catch (Exception e) { - Log.e(TAG, "Failed to apply audible", e); - return false; - } - - return true; - } - - public static boolean setUIAudible(Context context, File ringtone_file, int type, String name) { - final String path = ringtone_file.getAbsolutePath(); - final String path_clone = "/system/media/audio/ui/" + name + ".ogg"; - - ContentValues values = new ContentValues(); - values.put(MediaStore.MediaColumns.DATA, path); - values.put(MediaStore.MediaColumns.TITLE, name); - values.put(MediaStore.MediaColumns.MIME_TYPE, "application/ogg"); - values.put(MediaStore.MediaColumns.SIZE, ringtone_file.length()); - values.put(MediaStore.Audio.Media.IS_RINGTONE, false); - values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false); - values.put(MediaStore.Audio.Media.IS_ALARM, false); - values.put(MediaStore.Audio.Media.IS_MUSIC, true); - - Uri uri = MediaStore.Audio.Media.getContentUriForPath(path); - Uri newUri = null; - Cursor c = context.getContentResolver().query(uri, - new String[]{ MediaStore.MediaColumns._ID }, - MediaStore.MediaColumns.DATA + "='" + path_clone + "'", - null, null); - - if (c != null && c.getCount() > 0) { - c.moveToFirst(); - String id = String.valueOf(c.getLong(0)); - c.close(); - - newUri = Uri.withAppendedPath(Uri.parse(MEDIA_CONTENT_URI), id); - try { - context.getContentResolver().update(uri, values, - MediaStore.MediaColumns._ID + "=" + id, null); - } catch (SQLiteConstraintException e) { - // intentionally left empty - } - } - - if (newUri == null) { - newUri = context.getContentResolver().insert(uri, values); - } - - try { - RingtoneManager.setActualDefaultRingtoneUri(context, type, newUri); - } catch (Exception e) { - Log.e(TAG, "Failed to apply ui audible", e); - return false; - } - - return true; - } - - public static boolean setDefaultAudible(Context context, int type) { - final String audiblePath = getDefaultAudiblePath(type); - if (audiblePath == null) { - return false; - } - - Uri uri = MediaStore.Audio.Media.getContentUriForPath(audiblePath); - Cursor c = context.getContentResolver().query(uri, - new String[]{ MediaStore.MediaColumns._ID }, - MediaStore.MediaColumns.DATA + "='" + audiblePath + "'", - null, null); - - if (c != null && c.getCount() > 0) { - c.moveToFirst(); - String id = String.valueOf(c.getLong(0)); - c.close(); - - uri = Uri.withAppendedPath(Uri.parse(MEDIA_CONTENT_URI), id); - } - - try { - RingtoneManager.setActualDefaultRingtoneUri(context, type, uri); - } catch (Exception e) { - Log.e(TAG, "Failed to apply default audible", e); - return false; - } - - return true; - } -} - diff --git a/services/core/java/com/android/server/substratum/SubstratumService.java b/services/core/java/com/android/server/substratum/SubstratumService.java deleted file mode 100644 index 5c5634bbf57..00000000000 --- a/services/core/java/com/android/server/substratum/SubstratumService.java +++ /dev/null @@ -1,1101 +0,0 @@ -/* - * Copyright (C) 2018 Projekt Development - * - * 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.server.substratum; - -import android.annotation.NonNull; -import android.app.AppGlobals; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.om.IOverlayManager; -import android.content.om.OverlayInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.IPackageDeleteObserver; -import android.content.pm.IPackageInstallObserver2; -import android.content.pm.IPackageManager; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.pm.Signature; -import android.content.res.AssetManager; -import android.content.ServiceConnection; -import android.content.substratum.ISubstratumService; -import android.database.ContentObserver; -import android.media.AudioManager; -import android.media.RingtoneManager; -import android.net.Uri; -import android.os.Binder; -import android.os.Bundle; -import android.os.Environment; -import android.os.FileUtils; -import android.os.Handler; -import android.os.IBinder; -import android.os.RemoteException; -import android.os.SELinux; -import android.os.ServiceManager; -import android.os.SystemProperties; -import android.os.UserHandle; -import android.provider.Settings; -import android.text.TextUtils; -import android.util.Log; - -import com.android.internal.substratum.ISubstratumHelperService; -import com.android.server.SystemService; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.Throwable; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; -import static android.os.Binder.getCallingUid; - -public final class SubstratumService extends SystemService { - - private static final String TAG = "SubstratumService"; - private static final String SUBSTRATUM_PACKAGE = "projekt.substratum"; - private static final boolean DEBUG = true; - - private static final Signature SUBSTRATUM_SIGNATURE = new Signature("" - + "308202eb308201d3a003020102020411c02f2f300d06092a864886f70d01010b050030263124302206" - + "03550403131b5375627374726174756d20446576656c6f706d656e74205465616d301e170d31363037" - + "30333032333335385a170d3431303632373032333335385a3026312430220603550403131b53756273" - + "74726174756d20446576656c6f706d656e74205465616d30820122300d06092a864886f70d01010105" - + "000382010f003082010a02820101008855626336f645a335aa5d40938f15db911556385f72f72b5f8b" - + "ad01339aaf82ae2d30302d3f2bba26126e8da8e76a834e9da200cdf66d1d5977c90a4e4172ce455704" - + "a22bbe4a01b08478673b37d23c34c8ade3ec040a704da8570d0a17fce3c7397ea63ebcde3a2a3c7c5f" - + "983a163e4cd5a1fc80c735808d014df54120e2e5708874739e22e5a22d50e1c454b2ae310b480825ab" - + "3d877f675d6ac1293222602a53080f94e4a7f0692b627905f69d4f0bb1dfd647e281cc0695e0733fa3" - + "efc57d88706d4426c4969aff7a177ac2d9634401913bb20a93b6efe60e790e06dad3493776c2c0878c" - + "e82caababa183b494120edde3d823333efd464c8aea1f51f330203010001a321301f301d0603551d0e" - + "04160414203ec8b075d1c9eb9d600100281c3924a831a46c300d06092a864886f70d01010b05000382" - + "01010042d4bd26d535ce2bf0375446615ef5bf25973f61ecf955bdb543e4b6e6b5d026fdcab09fec09" - + "c747fb26633c221df8e3d3d0fe39ce30ca0a31547e9ec693a0f2d83e26d231386ff45f8e4fd5c06095" - + "8681f9d3bd6db5e940b1e4a0b424f5c463c79c5748a14a3a38da4dd7a5499dcc14a70ba82a50be5fe0" - + "82890c89a27e56067d2eae952e0bcba4d6beb5359520845f1fdb7df99868786055555187ba46c69ee6" - + "7fa2d2c79e74a364a8b3544997dc29cc625395e2f45bf8bdb2c9d8df0d5af1a59a58ad08b32cdbec38" - + "19fa49201bb5b5aadeee8f2f096ac029055713b77054e8af07cd61fe97f7365d0aa92d570be98acb89" - + "41b8a2b0053b54f18bfde092eb"); - - private static final Signature SUBSTRATUM_CI_SIGNATURE = new Signature("" - + "308201dd30820146020101300d06092a864886f70d010105050030373116301406035504030c0d416e" - + "64726f69642044656275673110300e060355040a0c07416e64726f6964310b30090603550406130255" - + "53301e170d3137303232333036303730325a170d3437303231363036303730325a3037311630140603" - + "5504030c0d416e64726f69642044656275673110300e060355040a0c07416e64726f6964310b300906" - + "035504061302555330819f300d06092a864886f70d010101050003818d00308189028181008aa6cf56" - + "e3ba4d0921da3baf527529205efbe440e1f351c40603afa5e6966e6a6ef2def780c8be80d189dc6101" - + "935e6f8340e61dc699cfd34d50e37d69bf66fbb58619d0ebf66f22db5dbe240b6087719aa3ceb1c68f" - + "3fa277b8846f1326763634687cc286b0760e51d1b791689fa2d948ae5f31cb8e807e00bd1eb72788b2" - + "330203010001300d06092a864886f70d0101050500038181007b2b7e432bff612367fbb6fdf8ed0ad1" - + "a19b969e4c4ddd8837d71ae2ec0c35f52fe7c8129ccdcdc41325f0bcbc90c38a0ad6fc0c604a737209" - + "17d37421955c47f9104ea56ad05031b90c748b94831969a266fa7c55bc083e20899a13089402be49a5" - + "edc769811adc2b0496a8a066924af9eeb33f8d57d625a5fa150f7bc18e55"); - - private static final File SYSTEM_THEME_DIR = - new File(Environment.getDataSystemDirectory(), "theme"); - private static final File SYSTEM_THEME_CACHE_DIR = new File(SYSTEM_THEME_DIR, "cache"); - private static final File SYSTEM_THEME_FONT_DIR = new File(SYSTEM_THEME_DIR, "fonts"); - private static final File SYSTEM_THEME_AUDIO_DIR = new File(SYSTEM_THEME_DIR, "audio"); - private static final File SYSTEM_THEME_RINGTONE_DIR = - new File(SYSTEM_THEME_AUDIO_DIR, "ringtones"); - private static final File SYSTEM_THEME_NOTIFICATION_DIR = - new File(SYSTEM_THEME_AUDIO_DIR, "notifications"); - private static final File SYSTEM_THEME_ALARM_DIR = new File(SYSTEM_THEME_AUDIO_DIR, "alarms"); - private static final File SYSTEM_THEME_UI_SOUNDS_DIR = new File(SYSTEM_THEME_AUDIO_DIR, "ui"); - private static final File SYSTEM_THEME_BOOTANIMATION_DIR = - new File(SYSTEM_THEME_DIR, "bootanimation.zip"); - private static final File SYSTEM_THEME_SHUTDOWNANIMATION_DIR = - new File(SYSTEM_THEME_DIR, "shutdownanimation.zip"); - - private static final Signature[] AUTHORIZED_SIGNATURES = new Signature[]{ - SUBSTRATUM_SIGNATURE, - SUBSTRATUM_CI_SIGNATURE, - }; - - private static final List SOUNDS = Arrays.asList( - new Sound(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath(), "/SoundsCache/ui/", "Effect_Tick", - "Effect_Tick", RingtoneManager.TYPE_RINGTONE), - new Sound(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath(), "/SoundsCache/ui/", "lock_sound", - "Lock"), - new Sound(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath(), "/SoundsCache/ui/", "unlock_sound", - "Unlock"), - new Sound(SYSTEM_THEME_ALARM_DIR.getAbsolutePath(), "/SoundsCache/alarms/", "alarm", - "alarm", RingtoneManager.TYPE_ALARM), - new Sound(SYSTEM_THEME_NOTIFICATION_DIR.getAbsolutePath(), "/SoundsCache/notifications/", - "notification", "notification", RingtoneManager.TYPE_NOTIFICATION), - new Sound(SYSTEM_THEME_RINGTONE_DIR.getAbsolutePath(), "/SoundsCache/ringtones/", - "ringtone", "ringtone", RingtoneManager.TYPE_RINGTONE) - ); - - private IOverlayManager mOm; - private IPackageManager mPm; - private boolean mIsWaiting; - private String mInstalledPackageName; - - private Context mContext; - private final Object mLock = new Object(); - private boolean mSigOverride = false; - private SettingsObserver mObserver = new SettingsObserver(); - - private ISubstratumHelperService mHelperService; - private final ServiceConnection mHelperConnection = new ServiceConnection() { - @Override - public void onServiceConnected(ComponentName name, IBinder service) { - mHelperService = ISubstratumHelperService.Stub.asInterface(service); - log("Helper service connected"); - } - - @Override - public void onServiceDisconnected(ComponentName name) { - mHelperService = null; - log("Helper service disconnected"); - } - }; - - public SubstratumService(@NonNull final Context context) { - super(context); - mContext = context; - } - - @Override - public void onBootPhase(int phase) { - if (phase == PHASE_SYSTEM_SERVICES_READY) { - if (makeDir(SYSTEM_THEME_DIR)) { - restoreconThemeDir(); - } - - mContext.getContentResolver().registerContentObserver( - Settings.Secure.getUriFor(Settings.Secure.FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES), - false, mObserver); - updateSettings(); - - mOm = IOverlayManager.Stub.asInterface(ServiceManager.getService("overlay")); - mPm = AppGlobals.getPackageManager(); - publishBinderService("substratum", mService); - - log("published substratum service"); - } - } - - @Override - public void onStart() { - // Intentionally left empty - } - - @Override - public void onSwitchUser(final int newUserId) { - // Intentionally left empty - } - - private void waitForHelperConnection() { - if (mHelperService == null) { - Intent intent = new Intent("projekt.substratum.helper.SubstratumHelperService"); - intent.setPackage("projekt.substratum.helper"); - mContext.bindServiceAsUser(intent, mHelperConnection, - Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT_BACKGROUND, UserHandle.SYSTEM); - int retryCount = 1; - while (mHelperService == null && retryCount <= 30) { - try { - Thread.sleep(100); - } catch (InterruptedException ignored) { - } - retryCount++; - } - } - } - - private boolean doSignaturesMatch(String packageName, Signature signature) { - if (packageName != null) { - try { - PackageInfo pi = mPm.getPackageInfo(packageName, - PackageManager.GET_SIGNATURES, UserHandle.USER_SYSTEM); - if (pi.signatures != null - && pi.signatures.length == 1 - && signature.equals(pi.signatures[0])) { - return true; - } - } catch (RemoteException ignored) { - return false; - } - } - return false; - } - - private void checkCallerAuthorization(int uid) { - String callingPackage; - try { - callingPackage = mPm.getPackagesForUid(uid)[0]; - } catch (RemoteException ignored) { - throw new SecurityException("Cannot check caller authorization"); - } - - if (TextUtils.equals(callingPackage, SUBSTRATUM_PACKAGE)) { - for (Signature sig : AUTHORIZED_SIGNATURES) { - if (doSignaturesMatch(callingPackage, sig)) { - return; - } - } - } - - if (mSigOverride) { - log("\'" + callingPackage + "\' is not an authorized calling package, but the user " + - "has explicitly allowed all calling packages, " + - "validating calling package permissions..."); - return; - } - - throw new SecurityException("Caller is not authorized"); - } - - private final IBinder mService = new ISubstratumService.Stub() { - @Override - public void installOverlay(List paths) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mLock) { - waitForHelperConnection(); - mHelperService.installOverlay(paths); - } - } catch (RemoteException ignored) { - // ¯\_(ツ)_/¯ - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void uninstallOverlay(List packages, boolean restartUi) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mLock) { - PackageDeleteObserver observer = new PackageDeleteObserver(); - for (String p : packages) { - if (isOverlayEnabled(p)) { - log("Remover - disabling overlay for \'" + p + "\'..."); - switchOverlayState(p, false); - } - - try { - PackageInfo pi = mPm.getPackageInfo(p, 0, UserHandle.USER_SYSTEM); - if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_HAS_CODE) == 0 && - pi.overlayTarget != null) { - log("Remover - uninstalling \'" + p + "\'..."); - mIsWaiting = true; - mPm.deletePackageAsUser( - p, - pi.versionCode, - observer, - 0, - UserHandle.USER_SYSTEM); - - while (mIsWaiting) { - try { - Thread.sleep(1); - } catch (InterruptedException e) { - // Someone interrupted my sleep, ugh! - } - } - } - } catch (RemoteException e) { - logE("There is an exception when trying to uninstall package", e); - } - } - if (restartUi) { - restartUi(); - } - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void switchOverlay(List packages, boolean enable, boolean restartUi) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mLock) { - for (String p : packages) { - log(enable ? "Enabling" : "Disabling" + " overlay " + p); - switchOverlayState(p, enable); - } - if (restartUi) { - restartUi(); - } - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void setPriority(List packages, boolean restartUi) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mLock) { - log("PriorityJob - processing priority changes..."); - for (int i = 0; i < packages.size() - 1; i++) { - String parentName = packages.get(i); - String packageName = packages.get(i + 1); - - mOm.setPriority(packageName, parentName, - UserHandle.USER_SYSTEM); - } - if (restartUi) { - restartUi(); - } - } - } catch (RemoteException e) { - logE("There is an exception when trying to adjust overlay priority", e); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void restartSystemUI() { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - log("Restarting SystemUI..."); - restartUi(); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void copy(String source, String destination) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - log("CopyJob - copying \'" + source + "\' to \'" + destination + "\'..."); - File sourceFile = new File(source); - if (sourceFile.exists()) { - if (sourceFile.isFile()) { - FileUtils.copyFile(sourceFile, new File(destination)); - } else { - copyDir(source, destination); - } - } else { - logE("CopyJob - \'" + source + "\' does not exist, aborting..."); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void move(String source, String destination) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - log("MoveJob - moving \'" + source + "\' to \'" + destination + "\'..."); - File sourceFile = new File(source); - if (sourceFile.exists()) { - if (sourceFile.isFile()) { - FileUtils.copyFile(sourceFile, new File(destination)); - } else { - copyDir(source, destination); - } - FileUtils.deleteContentsAndDir(sourceFile); - } else { - logE("MoveJob - \'" + source + "\' does not exist, aborting..."); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void mkdir(String destination) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - log("MkdirJob - creating \'" + destination + "\'..."); - makeDir(new File(destination)); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void deleteDirectory(String directory, boolean withParent) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - if (withParent) { - FileUtils.deleteContentsAndDir(new File(directory)); - } else { - FileUtils.deleteContents(new File(directory)); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void applyBootanimation(String name) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - if (name == null) { - log("Restoring system boot animation..."); - clearBootAnimation(); - } else { - log("Configuring themed boot animation..."); - copyBootAnimation(name); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void applyFonts(String pid, String fileName) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - if (pid == null) { - log("Restoring system font..."); - clearFonts(); - } else { - log("Configuring theme font..."); - copyFonts(pid, fileName); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void applySounds(String pid, String fileName) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - if (pid == null) { - log("Restoring system sounds..."); - clearSounds(); - } else { - log("Configuring theme sounds..."); - applyThemedSounds(pid, fileName); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void applyProfile(List enable, List disable, String name, - boolean restartUi) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - log("ProfileJob - Applying profile: " + name); - waitForHelperConnection(); - boolean mRestartUi = restartUi; - - boolean oldFontsExists = SYSTEM_THEME_FONT_DIR.exists(); - boolean oldSoundsExists = SYSTEM_THEME_AUDIO_DIR.exists(); - - mHelperService.applyProfile(name); - - boolean newFontsExists = SYSTEM_THEME_FONT_DIR.exists(); - boolean newSoundsExists = SYSTEM_THEME_AUDIO_DIR.exists(); - - if (oldFontsExists || newFontsExists) { - refreshFonts(); - } - - if (oldSoundsExists || newSoundsExists) { - refreshSounds(); - mRestartUi = true; - } - - for (String overlay : disable) { - switchOverlayState(overlay, false); - } - - for (String overlay : enable) { - switchOverlayState(overlay, true); - } - - if (mRestartUi) { - restartUi(); - } - - log("ProfileJob - " + name + " successfully applied."); - } catch (RemoteException e) { - logE("Failed to apply profile", e); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public void applyShutdownAnimation(String name) { - checkCallerAuthorization(Binder.getCallingUid()); - final long ident = Binder.clearCallingIdentity(); - try { - if (name == null) { - log("Restoring system shutdown animation..."); - clearShutdownAnimation(); - } else { - log("Configuring themed shutdown animation..."); - copyShutdownAnimation(name); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override - public Map getAllOverlays(int uid) { - checkCallerAuthorization(Binder.getCallingUid()); - try { - return mOm.getAllOverlays(uid); - } catch (RemoteException e) { - logE("There is an exception when trying to get all overlays", e); - return null; - } - } - - @Override - public boolean setEnabled(final String packageName, final boolean enable, - int userId) throws RemoteException { - userId = Binder.getCallingUid(); - if (packageName == null) { - return false; - } - log("setEnabled - File name = \'" + packageName + "\'"); - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mLock) { - return mOm.setEnabled(packageName, enable, UserHandle.USER_SYSTEM); - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - }; - - private Context getAppContext(String packageName) { - Context ctx = null; - try { - ctx = mContext.createPackageContext(packageName, - Context.CONTEXT_IGNORE_SECURITY); - } catch (NameNotFoundException e) { - logE("Failed to get " + packageName + " context"); - } - return ctx; - } - - private void switchOverlayState(String packageName, boolean enable) { - try { - mOm.setEnabled(packageName, enable, UserHandle.USER_SYSTEM); - } catch (RemoteException e) { - logE("There is an exception when trying to switch overlay state", e); - } - } - - private boolean isOverlayEnabled(String packageName) { - boolean enabled = false; - try { - OverlayInfo info = mOm.getOverlayInfo(packageName, UserHandle.USER_SYSTEM); - if (info != null) { - enabled = info.isEnabled(); - } else { - logE("Can't find OverlayInfo for " + packageName); - } - } catch (RemoteException e) { - logE("There is an exception when trying to check overlay state", e); - } - return enabled; - } - - private void restartUi() { - Intent i = new Intent("com.android.systemui.action.RESTART_THEME"); - i.setPackage("com.android.systemui"); - mContext.sendBroadcastAsUser(i, UserHandle.SYSTEM); - } - - private void copyBootAnimation(String fileName) { - try { - waitForHelperConnection(); - mHelperService.applyBootAnimation(); - } catch (RemoteException e) { - logE("There is an exception when trying to apply boot animation", e); - } - } - - private void clearBootAnimation() { - if (SYSTEM_THEME_BOOTANIMATION_DIR.exists()) { - boolean deleted = SYSTEM_THEME_BOOTANIMATION_DIR.delete(); - if (!deleted) { - logE("Could not delete themed boot animation"); - } - } - } - - private void copyShutdownAnimation(String fileName) { - try { - waitForHelperConnection(); - mHelperService.applyShutdownAnimation(); - } catch (RemoteException e) { - logE("There is an exception when trying to apply shutdown animation", e); - } - } - - private void clearShutdownAnimation() { - if (SYSTEM_THEME_SHUTDOWNANIMATION_DIR.exists()) { - boolean deleted = SYSTEM_THEME_SHUTDOWNANIMATION_DIR.delete(); - if (!deleted) { - logE("Could not delete themed shutdown animation"); - } - } - } - - private void copyFonts(String pid, String zipFileName) { - // Prepare local cache dir for font package assembly - log("Copy Fonts - Package ID = " + pid + " filename = " + zipFileName); - - File cacheDir = new File(SYSTEM_THEME_CACHE_DIR, "FontCache"); - if (cacheDir.exists()) { - FileUtils.deleteContentsAndDir(cacheDir); - } - - boolean created = cacheDir.mkdirs(); - if (!created) { - Log.e(TAG, "Could not create cache directory..."); - logE("Could not create cache directory"); - } - - // Copy system fonts into our cache dir - copyDir("/system/fonts", cacheDir.getAbsolutePath()); - - // Append zip to filename since it is probably removed - // for list presentation - if (!zipFileName.endsWith(".zip")) { - zipFileName = zipFileName + ".zip"; - } - - // Copy target themed fonts zip to our cache dir - Context themeContext = getAppContext(pid); - AssetManager am = themeContext.getAssets(); - File fontZip = new File(cacheDir, zipFileName); - try (InputStream inputStream = am.open("fonts/" + zipFileName)) { - FileUtils.copyToFile(inputStream, fontZip); - } catch (IOException e) { - logE("There is an exception when trying to copy themed fonts", e); - } - - // Unzip new fonts and delete zip file, overwriting any system fonts - unzip(fontZip.getAbsolutePath(), cacheDir.getAbsolutePath()); - - boolean deleted = fontZip.delete(); - if (!deleted) { - logE("Could not delete ZIP file"); - } - - // Check if theme zip included a fonts.xml. If not, get from existing file in /system - File srcConfig = new File("/system/etc/fonts.xml"); - File dstConfig = new File(cacheDir, "fonts.xml"); - if (!dstConfig.exists()) { - FileUtils.copyFile(srcConfig, dstConfig); - } - - // Prepare system theme fonts folder and copy new fonts folder from our cache - FileUtils.deleteContentsAndDir(SYSTEM_THEME_FONT_DIR); - makeDir(SYSTEM_THEME_FONT_DIR); - copyDir(cacheDir.getAbsolutePath(), SYSTEM_THEME_FONT_DIR.getAbsolutePath()); - - // Let system know it's time for a font change - FileUtils.deleteContentsAndDir(cacheDir); - refreshFonts(); - } - - private void clearFonts() { - FileUtils.deleteContentsAndDir(SYSTEM_THEME_FONT_DIR); - refreshFonts(); - } - - private void refreshFonts() { - // Set permissions on font files and config xml - if (SYSTEM_THEME_FONT_DIR.exists()) { - // Set permissions - setPermissionsRecursive(SYSTEM_THEME_FONT_DIR, - FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, - FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH); - restoreconThemeDir(); - } - - // Let system know it's time for a font change - SystemProperties.set("sys.refresh_font", "true"); - float fontSize = Settings.System.getFloatForUser(mContext.getContentResolver(), - Settings.System.FONT_SCALE, 1.0f, UserHandle.USER_CURRENT); - Settings.System.putFloatForUser(mContext.getContentResolver(), - Settings.System.FONT_SCALE, (fontSize + 0.0000001f), UserHandle.USER_CURRENT); - restartUi(); - } - - private void applyThemedSounds(String pid, String zipFileName) { - // Prepare local cache dir for font package assembly - log("CopySounds - Package ID = \'" + pid + "\'"); - log("CopySounds - File name = \'" + zipFileName + "\'"); - - File cacheDir = new File(SYSTEM_THEME_CACHE_DIR, "SoundsCache"); - if (cacheDir.exists()) { - FileUtils.deleteContentsAndDir(cacheDir); - } - - boolean created = cacheDir.mkdirs(); - if (!created) { - logE("Could not create cache directory"); - } - - // Append zip to filename since it is probably removed - // for list presentation - if (!zipFileName.endsWith(".zip")) { - zipFileName = zipFileName + ".zip"; - } - - // Copy target themed sounds zip to our cache dir - Context themeContext = getAppContext(pid); - AssetManager am = themeContext.getAssets(); - File soundsZip = new File(cacheDir, zipFileName); - try (InputStream inputStream = am.open("audio/" + zipFileName)) { - FileUtils.copyToFile(inputStream, soundsZip); - } catch (IOException e) { - logE("There is an exception when trying to copy themed sounds", e); - } - - // Unzip new sounds and delete zip file - unzip(soundsZip.getAbsolutePath(), cacheDir.getAbsolutePath()); - - boolean deleted = soundsZip.delete(); - if (!deleted) { - logE("Could not delete ZIP file"); - } - - clearSounds(); - makeDir(SYSTEM_THEME_AUDIO_DIR); - - for (Sound sound : SOUNDS) { - File soundsCache = new File(SYSTEM_THEME_CACHE_DIR, sound.cachePath); - - if (!(soundsCache.exists() && soundsCache.isDirectory())) { - continue; - } - - makeDir(new File(sound.themePath)); - - File mp3 = new File(SYSTEM_THEME_CACHE_DIR, sound.cachePath + sound.soundPath + ".mp3"); - File ogg = new File(SYSTEM_THEME_CACHE_DIR, sound.cachePath + sound.soundPath + ".ogg"); - if (ogg.exists()) { - FileUtils.copyFile(ogg, - new File(sound.themePath + File.separator + sound.soundPath + ".ogg")); - } else if (mp3.exists()) { - FileUtils.copyFile(mp3, - new File(sound.themePath + File.separator + sound.soundPath + ".mp3")); - } - } - - // Let system know it's time for a sound change - FileUtils.deleteContentsAndDir(cacheDir); - refreshSounds(); - } - - private void clearSounds() { - FileUtils.deleteContentsAndDir(SYSTEM_THEME_AUDIO_DIR); - refreshSounds(); - } - - private void refreshSounds() { - if (!SYSTEM_THEME_AUDIO_DIR.exists()) { - // reset to default sounds - SoundUtils.setDefaultAudible(mContext, RingtoneManager.TYPE_ALARM); - SoundUtils.setDefaultAudible(mContext, RingtoneManager.TYPE_NOTIFICATION); - SoundUtils.setDefaultAudible(mContext, RingtoneManager.TYPE_RINGTONE); - SoundUtils.setDefaultUISounds(mContext.getContentResolver(), "lock_sound", "Lock.ogg"); - SoundUtils.setDefaultUISounds(mContext.getContentResolver(), "unlock_sound", "Unlock.ogg"); - } else { - // Set permissions - setPermissionsRecursive(SYSTEM_THEME_AUDIO_DIR, - FileUtils.S_IRWXU | FileUtils.S_IRGRP | FileUtils.S_IRWXO, - FileUtils.S_IRWXU | FileUtils.S_IRWXG | FileUtils.S_IROTH | FileUtils.S_IXOTH); - - for (Sound sound : SOUNDS) { - File themePath = new File(sound.themePath); - - if (!(themePath.exists() && themePath.isDirectory())) { - continue; - } - - String metadataName; - switch (sound.type) { - case RingtoneManager.TYPE_RINGTONE: - metadataName = "Theme Ringtone"; - break; - case RingtoneManager.TYPE_NOTIFICATION: - metadataName = "Theme Notification"; - break; - case RingtoneManager.TYPE_ALARM: - metadataName = "Theme Alarm"; - break; - default: - metadataName = "Theme"; - } - - File mp3 = new File(themePath, sound.soundPath + ".mp3"); - File ogg = new File(themePath, sound.soundPath + ".ogg"); - - if (ogg.exists()) { - if (sound.themePath.equals(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath()) - && sound.type != 0) { // Effect_Tick - SoundUtils.setUIAudible(mContext, ogg, sound.type, sound.soundName); - } else if (sound.themePath.equals(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath())) { - SoundUtils.setUISounds(mContext.getContentResolver(), sound.soundName, ogg - .getAbsolutePath()); - } else { - SoundUtils.setAudible(mContext, ogg, sound.type, metadataName); - } - } else if (mp3.exists()) { - if (sound.themePath.equals(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath()) - && sound.type != 0) { // Effect_Tick - SoundUtils.setUIAudible(mContext, mp3, sound.type, sound.soundName); - } else if (sound.themePath.equals(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath())) { - SoundUtils.setUISounds(mContext.getContentResolver(), sound.soundName, - mp3.getAbsolutePath()); - } else { - SoundUtils.setAudible(mContext, mp3, sound.type, metadataName); - } - } else { - if (sound.themePath.equals(SYSTEM_THEME_UI_SOUNDS_DIR.getAbsolutePath())) { - SoundUtils.setDefaultUISounds(mContext.getContentResolver(), - sound.soundName, sound.soundPath + ".ogg"); - } else { - SoundUtils.setDefaultAudible(mContext, sound.type); - } - } - } - } - - // Refresh sounds - Intent i = new Intent("com.android.systemui.action.REFRESH_SOUND"); - i.setPackage("com.android.systemui"); - mContext.sendBroadcastAsUser(i, UserHandle.SYSTEM); - - final boolean soundEffectEnabled = Settings.System.getInt(mContext.getContentResolver(), - Settings.System.SOUND_EFFECTS_ENABLED, 1) == 1; - if (soundEffectEnabled) { - AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); - am.unloadSoundEffects(); - am.loadSoundEffects(); - } - } - - private void unzip(String source, String destination) { - try (ZipInputStream inputStream = new ZipInputStream( - new BufferedInputStream(new FileInputStream(source)))) { - ZipEntry zipEntry; - int count; - byte[] buffer = new byte[8192]; - - while ((zipEntry = inputStream.getNextEntry()) != null) { - File file = new File(destination, zipEntry.getName()); - File dir = zipEntry.isDirectory() ? file : file.getParentFile(); - - if (!dir.isDirectory() && !dir.mkdirs()) { - throw new FileNotFoundException("Failed to ensure directory: " + - dir.getAbsolutePath()); - } - - if (zipEntry.isDirectory()) { - continue; - } - - try (FileOutputStream outputStream = new FileOutputStream(file)) { - while ((count = inputStream.read(buffer)) != -1) { - outputStream.write(buffer, 0, count); - } - } - } - } catch (IOException e) { - logE("There is an exception when trying to unzip", e); - } - } - - private boolean makeDir(File dir) { - - if (dir.exists()) { - return dir.isDirectory(); - } - - if (dir.mkdirs()) { - int permissions = FileUtils.S_IRWXU | FileUtils.S_IRWXG | - FileUtils.S_IRWXO; - SELinux.restorecon(dir); - return FileUtils.setPermissions(dir, permissions, -1, -1) == 0; - } - - return false; - } - - private boolean copyDir(String src, String dst) { - File[] files = new File(src).listFiles(); - boolean success = true; - - if (files != null) { - for (File file : files) { - File newFile = new File(dst + File.separator + - file.getName()); - if (file.isDirectory()) { - success &= copyDir(file.getAbsolutePath(), - newFile.getAbsolutePath()); - } else { - success &= FileUtils.copyFile(file, newFile); - } - } - } else { - // not a directory - success = false; - } - return success; - } - - void setPermissions(File path, int permissions) { - FileUtils.setPermissions(path, permissions, -1, -1); - } - - void setPermissionsRecursive(File dir, int file, int folder) { - if (!dir.isDirectory()) { - setPermissions(dir, file); - return; - } - - for (File child : dir.listFiles()) { - if (child.isDirectory()) { - setPermissionsRecursive(child, file, folder); - setPermissions(child, folder); - } else { - setPermissions(child, file); - } - } - - setPermissions(dir, folder); - } - - private boolean restoreconThemeDir() { - return SELinux.restoreconRecursive(SYSTEM_THEME_DIR); - } - - private void log(String msg) { - if (DEBUG) { - Log.e(TAG, msg); - } - } - - private void logE(String msg, Throwable tr) { - if (tr != null) { - Log.e(TAG, msg, tr); - } else { - Log.e(TAG, msg); - } - } - - private void logE(String msg) { - logE(msg, null); - } - - private void updateSettings() { - synchronized (mLock) { - mSigOverride = Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.FORCE_AUTHORIZE_SUBSTRATUM_PACKAGES, 1, - UserHandle.USER_CURRENT) == 1; - } - } - - private static class Sound { - String themePath; - String cachePath; - String soundName; - String soundPath; - int type; - - Sound(String themePath, String cachePath, String soundName, String soundPath) { - this.themePath = themePath; - this.cachePath = cachePath; - this.soundName = soundName; - this.soundPath = soundPath; - } - - Sound(String themePath, String cachePath, String soundName, String soundPath, int type) { - this.themePath = themePath; - this.cachePath = cachePath; - this.soundName = soundName; - this.soundPath = soundPath; - this.type = type; - } - } - - private class SettingsObserver extends ContentObserver { - public SettingsObserver() { - super(new Handler()); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - updateSettings(); - } - }; - - private class PackageInstallObserver extends IPackageInstallObserver2.Stub { - @Override - public void onUserActionRequired(Intent intent) throws RemoteException { - log("Installer - user action required callback"); - mIsWaiting = false; - } - - @Override - public void onPackageInstalled(String packageName, int returnCode, - String msg, Bundle extras) { - log("Installer - successfully installed \'" + packageName + "\'!"); - mInstalledPackageName = packageName; - mIsWaiting = false; - } - } - - private class PackageDeleteObserver extends IPackageDeleteObserver.Stub { - @Override - public void packageDeleted(String packageName, int returnCode) { - log("Remover - successfully removed \'" + packageName + "\'"); - mIsWaiting = false; - } - } -} - diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 09ee41d2974..524d7cee171 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -540,7 +540,6 @@ public void dump(FileDescriptor fd, PrintWriter pw, String[] args, boolean asPro boolean mDisplayReady; boolean mSafeMode; - boolean mDisableOverlays; boolean mDisplayEnabled = false; boolean mSystemBooted = false; boolean mForceDisplayEnabled = false; @@ -4555,27 +4554,6 @@ public boolean detectSafeMode() { return mSafeMode; } - public boolean detectDisableOverlays() { - if (!mInputMonitor.waitForInputDevicesReady( - INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { - Slog.w(TAG_WM, "Devices still not ready after waiting " - + INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS - + " milliseconds before attempting to detect safe mode."); - } - - int volumeUpState = mInputManager.getKeyCodeState(-1, InputDevice.SOURCE_ANY, - KeyEvent.KEYCODE_VOLUME_UP); - mDisableOverlays = volumeUpState > 0; - - if (mDisableOverlays) { - Log.i(TAG_WM, "All enabled theme overlays will now be disabled."); - } else { - Log.i(TAG_WM, "System will boot with enabled overlays intact."); - } - - return mDisableOverlays; - } - public void displayReady() { final int displayCount = mRoot.mChildren.size(); for (int i = 0; i < displayCount; ++i) { diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index e27bf961c2d..36a77ddad3c 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -121,7 +121,6 @@ import com.android.server.stats.StatsCompanionService; import com.android.server.statusbar.StatusBarManagerService; import com.android.server.storage.DeviceStorageMonitorService; -import com.android.server.substratum.SubstratumService; import com.android.server.telecom.TelecomLoaderService; import com.android.server.textclassifier.TextClassificationManagerService; import com.android.server.trust.TrustManagerService; @@ -715,11 +714,6 @@ private void startBootstrapServices() { OverlayManagerService overlayManagerService = new OverlayManagerService( mSystemContext, installer); mSystemServiceManager.startService(overlayManagerService); - - // Substratum system server implementation - traceBeginAndSlog("StartSubstratumService"); - mSystemServiceManager.startService(new SubstratumService(mSystemContext)); - traceEnd(); if (SystemProperties.getInt("persist.sys.displayinset.top", 0) > 0) { @@ -1782,12 +1776,6 @@ private void startOtherServices() { mActivityManagerService.showSafeModeOverlay(); } - // Let's check whether we should disable all theme overlays - final boolean disableOverlays = wm.detectDisableOverlays(); - if (disableOverlays) { - mActivityManagerService.disableOverlays(); - } - // Update the configuration for this context by hand, because we're going // to start using it before the config change done in wm.systemReady() will // propagate to it.