diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 11020b243200..eacb0d592362 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include @@ -748,6 +750,24 @@ bool BootAnimation::findBootAnimationFileInternal(const std::vector return false; } +std::string getBootAnimationPath() { + std::string propValue = android::base::GetProperty("persist.sys.somethingos.bootanimation", ""); + + static const std::unordered_map bootAnimationPaths { + {"somethingos", "/product/media/bootanimation.zip"}, + {"fox", "/product/media/fox.zip"}, + {"legacy", "/product/media/legacy.zip"}, + {"circle", "/product/media/circle.zip"} + }; + + auto it = bootAnimationPaths.find(propValue); + if (it != bootAnimationPaths.end()) { + return it->second; + } else { + return "/product/media/bootanimation.zip"; + } +} + void BootAnimation::findBootAnimationFile() { std::string custAnimProp = !mShuttingDown ? @@ -764,7 +784,7 @@ void BootAnimation::findBootAnimationFile() { ATRACE_CALL(); const bool playDarkAnim = android::base::GetIntProperty("ro.boot.theme", 0) == 1; static const std::vector bootFiles = { - APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : PRODUCT_BOOTANIMATION_FILE, + APEX_BOOTANIMATION_FILE, playDarkAnim ? PRODUCT_BOOTANIMATION_DARK_FILE : getBootAnimationPath(), OEM_BOOTANIMATION_FILE, SYSTEM_BOOTANIMATION_FILE }; static const std::vector shutdownFiles = { diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 5956e2bde242..d21ca0d8cc5a 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -130,6 +130,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.os.SomeArgs; import com.android.internal.util.UserIcons; +import com.android.internal.util.SomeImitationHooks; import dalvik.system.VMRuntime; @@ -828,7 +829,8 @@ public Boolean recompute(HasSystemFeatureQuery query) { @Override public boolean hasSystemFeature(String name, int version) { - return mHasSystemFeatureCache.query(new HasSystemFeatureQuery(name, version)); + return SomeImitationHooks.hasSystemFeature(name, + mHasSystemFeatureCache.query(new HasSystemFeatureQuery(name, version))); } /** @hide */ diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java index 67b104de4a10..a9599354d564 100644 --- a/core/java/android/app/Instrumentation.java +++ b/core/java/android/app/Instrumentation.java @@ -62,6 +62,7 @@ import android.view.WindowManagerGlobal; import com.android.internal.content.ReferrerIntent; +import com.android.internal.util.SomeImitationHooks; import java.io.File; import java.lang.annotation.Retention; @@ -1352,6 +1353,7 @@ public Application newApplication(ClassLoader cl, String className, Context cont Application app = getFactory(context.getPackageName()) .instantiateApplication(cl, className); app.attach(context); + SomeImitationHooks.setProps(app); return app; } @@ -1369,6 +1371,7 @@ static public Application newApplication(Class clazz, Context context) ClassNotFoundException { Application app = (Application)clazz.newInstance(); app.attach(context); + SomeImitationHooks.setProps(app); return app; } diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index a18c8f940db0..cd5f53aa34a3 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -276,6 +276,11 @@ import com.android.internal.policy.PhoneLayoutInflater; import com.android.internal.util.Preconditions; +import com.android.internal.lineage.app.LineageContextConstants; +import com.android.internal.lineage.app.LineageGlobalActions; +import com.android.internal.lineage.app.ILineageGlobalActions; + +import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -1017,6 +1022,19 @@ public PocketManager createService(ContextImpl ctx) { return new PocketManager(ctx.getOuterContext(), service); }}); + registerService(LineageContextConstants.LINEAGE_GLOBAL_ACTIONS_SERVICE, LineageGlobalActions.class, + new CachedServiceFetcher() { + @Override + public LineageGlobalActions createService(ContextImpl ctx) + throws ServiceNotFoundException { + final IBinder binder = + ServiceManager.getServiceOrThrow(LineageContextConstants.LINEAGE_GLOBAL_ACTIONS_SERVICE); + final ILineageGlobalActions service = + ILineageGlobalActions.Stub.asInterface(binder); + return new LineageGlobalActions(service); + } + }); + registerService(Context.TV_INTERACTIVE_APP_SERVICE, TvInteractiveAppManager.class, new CachedServiceFetcher() { @Override diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 4b579e7db9f8..984b137580da 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -5603,6 +5603,20 @@ private Bundle parseMetaData(Resources res, if (data == null) { data = new Bundle(); + data.putBoolean("batch_opted_out_by_default", true); + data.putBoolean("com.ad4screen.no_geoloc", true); + data.putBoolean("com.facebook.sdk.AutoLogAppEventsEnabled", false); + data.putBoolean("com.mixpanel.android.MPConfig.UseIpAddressForGeolocation", false); + data.putBoolean("com.webengage.sdk.android.location_tracking", false); + data.putBoolean("firebase_analytics_collection_deactivated", true); + data.putBoolean("firebase_analytics_collection_enabled", false); + data.putBoolean("firebase_crash_collection_enabled", false); + data.putBoolean("firebase_performance_collection_deactivated", true); + data.putBoolean("google_analytics_adid_collection_enabled", false); + data.putBoolean("google_analytics_ssaid_collection_enabled", false); + data.putBoolean("google_analytics_default_allow_ad_personalization_signals", false); + data.putString("com.ad4screen.tracking_mode", "Restricted"); + data.putString("com.sprooki.LOCATION_SERVICES", "disable"); } String name = sa.getNonConfigurationString( diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index dbb6f92c6411..8d76be97c4c9 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -170,4 +170,6 @@ interface IPowerManager const int GO_TO_SLEEP_REASON_MAX = 10; const int GO_TO_SLEEP_FLAG_NO_DOZE = 1 << 0; + // custom API + void rebootCustom(boolean confirm, String reason, boolean wait); } diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java index 406a1a6795ab..c8c3d543fc62 100644 --- a/core/java/android/os/PowerManager.java +++ b/core/java/android/os/PowerManager.java @@ -872,6 +872,27 @@ public int hashCode() { */ public static final String REBOOT_RECOVERY_UPDATE = "recovery-update"; + /** + * The value to pass as the 'reason' argument to reboot() to + * reboot into bootloader mode + * @hide + */ + public static final String REBOOT_BOOTLOADER = "bootloader"; + + /** + * The value to pass as the 'reason' argument to reboot() to + * reboot into download mode + * @hide + */ + public static final String REBOOT_DOWNLOAD = "download"; + + /** + * The value to pass as the 'reason' argument to reboot() to + * reboot into fastboot mode + * @hide + */ + public static final String REBOOT_FASTBOOT = "fastboot"; + /** * The value to pass as the 'reason' argument to reboot() when device owner requests a reboot on * the device. @@ -1894,6 +1915,24 @@ public void reboot(@Nullable String reason) { } } + /** + * Reboot the device. Will not return if the reboot is successful. + *

+ * Requires the {@link android.Manifest.permission#REBOOT} permission. + *

+ * + * @param reason code to pass to the kernel (e.g., "recovery", "bootloader", "download") to + * request special boot modes, or null. + * @hide + */ + public void rebootCustom(String reason) { + try { + mService.rebootCustom(false, reason, true); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** * Reboot the device. Will not return if the reboot is successful. *

diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 33d808d8daff..bf15b300b47f 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -5187,6 +5187,49 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean */ public static final String DC_DIMMING_STATE = "dc_dimming_state"; + /** + * Display style of the status bar battery information + * 0: Display the battery an icon in portrait mode + * 1: Display the battery as a circle + * 2: Display the battery as plain text + * default: 0 + * @hide + */ + public static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style"; + + /** + * Status bar battery % + * 0: Hide the battery percentage + * 1: Display the battery percentage next to the icon + * 2: Display the battery percentage inside the icon + * + * @hide + */ + public static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_battery_percent"; + + /** + * Whether to show the clock in the right or left position or show it in the + * center + * 0: show the clock in the left position (LTR) + * 1: show the clock in the center + * 2: show the clock in the right position (LTR) + * default: 0 + * + * @hide + */ + public static final String STATUS_BAR_CLOCK = "status_bar_clock"; + + /** + * Display style of AM/PM next to clock in status bar + * 0: No display (Gingerbread/ICS stock) + * 1: Small display (Froyo stock) + * 2: Normal display (Eclair stock) + * default: 0 + * + * @hide + */ + public static final String STATUS_BAR_AM_PM = "status_bar_am_pm"; + /** * Control whether to enable adaptive sleep mode. * @deprecated Use {@link android.provider.Settings.Secure#ADAPTIVE_SLEEP} instead. @@ -6294,6 +6337,16 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean */ public static final String CHARGING_CONTROL_LIMIT = "charging_control_charging_limit"; + /** + * Setting to enable / disable the navigation bar hint. + *

    + *
  • 0 = Off + *
  • 1 = On + *
+ * @hide + */ + public static final String NAVIGATION_BAR_HINT = "navigation_bar_hint"; + /** * Setting to enable camera flash notification feature. *
    @@ -6340,6 +6393,12 @@ public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean */ public static final String ADAPTIVE_PLAYBACK_TIMEOUT = "adaptive_playback_timeout"; + /** + * Whether to take partial screenshot with volume down + power click. + * @hide + */ + public static final String CLICK_PARTIAL_SCREENSHOT = "click_partial_screenshot"; + /** * IMPORTANT: If you add a new public settings you also have to add it to * PUBLIC_SETTINGS below. If the new setting is hidden you have to add @@ -11614,12 +11673,9 @@ public static boolean putFloatForUser(ContentResolver cr, String name, float val * 0 indicates disabled and 1 indicates enabled. A non existent value should be treated as * enabled. * - * @deprecated Controls are migrated to Quick Settings, rendering this unnecessary and will - * be removed in a future release. * @hide */ @Readable - @Deprecated public static final String CONTROLS_ENABLED = "controls_enabled"; /** @@ -11856,6 +11912,12 @@ public static boolean putFloatForUser(ContentResolver cr, String name, float val @SystemApi public static final int VOLUME_HUSH_MUTE = 2; + /** + * Whether to include options in power menu for rebooting into recovery or bootloader + * @hide + */ + public static final String ADVANCED_REBOOT = "advanced_reboot"; + /** * The number of times (integer) the user has manually enabled battery saver. * @hide @@ -12653,6 +12715,13 @@ public static boolean putFloatForUser(ContentResolver cr, String name, float val public static final String EXTRA_AUTOMATIC_POWER_SAVE_MODE = "extra_automatic_power_save_mode"; + /** + * Control whether FLAG_SECURE is ignored for all windows. + * @hide + */ + @Readable + public static final String WINDOW_IGNORE_SECURE = "window_ignore_secure"; + /** * Whether contextual screen timeout is enabled. * @@ -12761,6 +12830,74 @@ public static boolean putFloatForUser(ContentResolver cr, String name, float val */ public static final String DOZE_ON_CHARGE = "doze_on_charge"; + /** + * Network traffic indicator mode + * 0 = Don't show network traffic indicator + * 1 = Display up-stream traffic only + * 2 = Display down-stream traffic only + * 3 = Display both up- and down-stream traffic + * + * @hide + */ + public static final String NETWORK_TRAFFIC_MODE = "network_traffic_mode"; + + /** + * Network traffic indicator position + * 0 = Start side + * 1 = Center + * 2 = End side + * + * @hide + */ + public static final String NETWORK_TRAFFIC_POSITION = "network_traffic_position"; + + /** + * Whether or not to hide the network traffic indicator when there is no + * activity + * + * @hide + */ + public static final String NETWORK_TRAFFIC_AUTOHIDE = "network_traffic_autohide"; + + /** + * Measurement unit preference for network traffic + * 0 = kBit/s + * 1 = MBit/s + * 2 = kByte/s + * 3 = MByte/s + * 4 = automatic kByte/s or MByte/s + * + * @hide + */ + public static final String NETWORK_TRAFFIC_UNITS = "network_traffic_units"; + + /** + * How to show measurement units in the network traffic indiciator + * 0 = off + * 1 = on + * 2 = compact + * + * @hide + */ + public static final String NETWORK_TRAFFIC_SHOW_UNITS = "network_traffic_show_units"; + + /** + * String to contain power menu actions + * @hide + */ + public static final String POWER_MENU_ACTIONS = "power_menu_actions"; + + /** + * Int value specifying the power menu type (default is 0) + * 0 - Lite + * 1 - Full + * 2 - Classic + * 3 - Grid + * 4 - Legacy + * @hide + */ + public static final String POWER_MENU_TYPE = "power_menu_type"; + /** * These entries are considered common between the personal and the managed profile, * since the managed profile doesn't get to change them. @@ -19301,6 +19438,12 @@ public static boolean putFloat(ContentResolver cr, String name, float value) { * @hide */ public static final String RESTRICTED_NETWORKING_MODE = "restricted_networking_mode"; + + /** + * Control whether application downgrade is allowed. + * @hide + */ + public static final String PM_DOWNGRADE_ALLOWED = "pm_downgrade_allowed"; /** * Setting indicating whether Low Power Standby is enabled, if supported. diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 52000d9b3c6c..3e1a55212661 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -20,6 +20,7 @@ import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; +import static android.view.WindowManager.LayoutParams.FLAG_SECURE; import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS; import android.annotation.ColorInt; @@ -52,6 +53,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; +import android.provider.Settings; import android.transition.Scene; import android.transition.Transition; import android.transition.TransitionManager; @@ -1303,6 +1305,10 @@ public void clearFlags(int flags) { * @see #clearFlags */ public void setFlags(int flags, int mask) { + if ((mask & FLAG_SECURE) != 0 && Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.WINDOW_IGNORE_SECURE, 0) == 1) { + mask &= ~FLAG_SECURE; + } final WindowManager.LayoutParams attrs = getAttributes(); attrs.flags = (attrs.flags&~mask) | (flags&mask); mForcedWindowFlags |= mask; diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 2280cfe7d2dc..a1920bd02c57 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -868,6 +868,12 @@ public interface KeyboardShortcutsReceiver { */ int TAKE_SCREENSHOT_FULLSCREEN = 1; + /** + * Invoke screenshot flow allowing the user to select a region. + * @hide + */ + int TAKE_SCREENSHOT_SELECTED_REGION = 2; + /** * Invoke screenshot flow with an image provided by the caller. * @hide @@ -880,6 +886,7 @@ public interface KeyboardShortcutsReceiver { * @hide */ @IntDef({TAKE_SCREENSHOT_FULLSCREEN, + TAKE_SCREENSHOT_SELECTED_REGION, TAKE_SCREENSHOT_PROVIDED_IMAGE}) @interface ScreenshotType {} diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index c624be619a6b..6c4c5d86b832 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -4967,6 +4967,7 @@ public void run() { FlingRunnable() { mScroller = new OverScroller(getContext()); + mScroller.setFriction(0.006f); } float getSplineFlingDistance(int velocity) { diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index b5bf529fadbd..39b67987a1a8 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -365,6 +365,7 @@ public int getMaxScrollAmount() { private void initScrollView() { mScroller = new OverScroller(getContext()); + mScroller.setFriction(0.006f); setFocusable(true); setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); diff --git a/services/core/java/com/android/server/lineage/common/UserContentObserver.java b/core/java/com/android/internal/database/UserContentObserver.java similarity index 98% rename from services/core/java/com/android/server/lineage/common/UserContentObserver.java rename to core/java/com/android/internal/database/UserContentObserver.java index e76c19ed692d..b86511e9c824 100644 --- a/services/core/java/com/android/server/lineage/common/UserContentObserver.java +++ b/core/java/com/android/internal/database/UserContentObserver.java @@ -14,7 +14,7 @@ * limitations under the License */ -package com.android.server.lineage.common; +package com.android.internal.database; import android.app.ActivityManagerNative; import android.app.IUserSwitchObserver; diff --git a/core/java/com/android/internal/lineage/app/ILineageGlobalActions.aidl b/core/java/com/android/internal/lineage/app/ILineageGlobalActions.aidl new file mode 100644 index 000000000000..330188cad0f1 --- /dev/null +++ b/core/java/com/android/internal/lineage/app/ILineageGlobalActions.aidl @@ -0,0 +1,29 @@ +/* + * Copyright 2021 The LineageOS 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.internal.lineage.app; + +/** @hide */ +interface ILineageGlobalActions { + + void updateUserConfig(boolean enabled, String action); + + List getLocalUserConfig(); + + String[] getUserActionsArray(); + + boolean userConfigContains(String preference); +} diff --git a/core/java/com/android/internal/lineage/app/LineageContextConstants.java b/core/java/com/android/internal/lineage/app/LineageContextConstants.java index 731f43a39468..301e6fac9adc 100644 --- a/core/java/com/android/internal/lineage/app/LineageContextConstants.java +++ b/core/java/com/android/internal/lineage/app/LineageContextConstants.java @@ -42,4 +42,11 @@ private LineageContextConstants() { */ public static final String LINEAGE_HEALTH_INTERFACE = "lineagehealth"; + /** + * Update power menu (GlobalActions) + * + * @hide + */ + public static final String LINEAGE_GLOBAL_ACTIONS_SERVICE = "lineageglobalactions"; + } diff --git a/core/java/com/android/internal/lineage/app/LineageGlobalActions.java b/core/java/com/android/internal/lineage/app/LineageGlobalActions.java new file mode 100644 index 000000000000..3828320dca0c --- /dev/null +++ b/core/java/com/android/internal/lineage/app/LineageGlobalActions.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2021 The LineageOS 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.internal.lineage.app; + +import java.util.List; + +import android.annotation.SystemService; +import android.os.RemoteException; +import android.util.Log; + +import com.android.internal.lineage.app.LineageContextConstants; + +@SystemService(LineageContextConstants.LINEAGE_GLOBAL_ACTIONS_SERVICE) +public class LineageGlobalActions { + + private static ILineageGlobalActions mService; + + private static final String TAG = "LineageGlobalActions"; + + public LineageGlobalActions(ILineageGlobalActions service) { + mService = service; + } + + /** + * Update the action to the state. + * @param enabled a {@link Boolean} value + * @param action a {@link String} value + */ + public void updateUserConfig(boolean enabled, String action) { + try { + mService.updateUserConfig(enabled, action); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Get the user configuration as {@link List}. + * @return {@link List} + */ + public List getLocalUserConfig() { + try { + return mService.getLocalUserConfig(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Get the user configuration as {@link String[]} in the same order as in the power menu. + * Actions are separated with | delimiter. + * @return {@link String[]} + */ + public String[] getUserActionsArray() { + try { + return mService.getUserActionsArray(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** + * Check if user configuration ({@link List}) contains + * preference ({@link String}) + * @param preference {@link String} + * @return {@link boolean} + */ + public boolean userConfigContains(String preference) { + try { + return mService.userConfigContains(preference); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } +} diff --git a/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java b/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java index 987fd4158418..ec5ff4c6946a 100644 --- a/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java +++ b/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java @@ -174,7 +174,7 @@ public ParsedProviderImpl[] newArray(int size) { // CHECKSTYLE:OFF Generated code // // To regenerate run: - // $ codegen $ANDROID_BUILD_TOP/frameworks/base/services/core/java/com/android/server/pm/pkg/component/ParsedProviderImpl.java + // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java // // To exclude the generated code from IntelliJ auto-formatting enable (one-time): // Settings > Editor > Code Style > Formatter Control @@ -298,9 +298,9 @@ public int getInitOrder() { } @DataClass.Generated( - time = 1642560323360L, + time = 1723882842941L, codegenVersion = "1.0.23", - sourceFile = "frameworks/base/services/core/java/com/android/server/pm/pkg/component/ParsedProviderImpl.java", + sourceFile = "frameworks/base/core/java/com/android/internal/pm/pkg/component/ParsedProviderImpl.java", inputSignatures = "private @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) java.lang.String authority\nprivate boolean syncable\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) java.lang.String readPermission\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInternedString.class) java.lang.String writePermission\nprivate boolean grantUriPermissions\nprivate boolean forceUriPermissions\nprivate boolean multiProcess\nprivate int initOrder\nprivate @android.annotation.NonNull java.util.List uriPermissionPatterns\nprivate @android.annotation.NonNull java.util.List pathPermissions\npublic static final @android.annotation.NonNull android.os.Parcelable.Creator CREATOR\npublic com.android.internal.pm.pkg.component.ParsedProviderImpl setReadPermission(java.lang.String)\npublic com.android.internal.pm.pkg.component.ParsedProviderImpl setWritePermission(java.lang.String)\npublic @android.annotation.NonNull com.android.internal.pm.pkg.component.ParsedProviderImpl addUriPermissionPattern(android.os.PatternMatcher)\npublic @android.annotation.NonNull com.android.internal.pm.pkg.component.ParsedProviderImpl addPathPermission(android.content.pm.PathPermission)\npublic java.lang.String toString()\npublic @java.lang.Override int describeContents()\npublic @java.lang.Override void writeToParcel(android.os.Parcel,int)\nclass ParsedProviderImpl extends com.android.internal.pm.pkg.component.ParsedMainComponentImpl implements [com.android.internal.pm.pkg.component.ParsedProvider, android.os.Parcelable]\n@com.android.internal.util.DataClass(genSetters=true, genGetters=true, genParcelable=false, genBuilder=false)") @Deprecated private void __metadata() {} diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 7855821d4383..6feef7ac3ceb 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -174,7 +174,7 @@ oneway interface IStatusBar void showPinningEnterExitToast(boolean entering); void showPinningEscapeToast(); - void showShutdownUi(boolean isReboot, String reason); + void showShutdownUi(boolean isReboot, String reason, boolean rebootCustom); /** * Used to show the authentication dialog (Biometrics, Device Credential). diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index 6c92cb454df8..62151bf08c24 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -102,7 +102,7 @@ interface IStatusBarService * These methods are needed for global actions control which the UI is shown in sysui. */ void shutdown(); - void reboot(boolean safeMode); + void reboot(boolean safeMode, String reason); /** just restarts android without rebooting device. Used for some feature flags. */ void restart(); diff --git a/core/java/com/android/internal/util/ScreenshotHelper.java b/core/java/com/android/internal/util/ScreenshotHelper.java index c21a43e807a9..0c3ac405c209 100644 --- a/core/java/com/android/internal/util/ScreenshotHelper.java +++ b/core/java/com/android/internal/util/ScreenshotHelper.java @@ -20,6 +20,7 @@ import android.os.UserHandle; import android.util.Log; import android.view.WindowManager.ScreenshotSource; +import android.view.WindowManager.ScreenshotType; import com.android.internal.annotations.VisibleForTesting; @@ -68,8 +69,25 @@ public ScreenshotHelper(Context context) { */ public void takeScreenshot(@ScreenshotSource int source, @NonNull Handler handler, @Nullable Consumer completionConsumer) { + takeScreenshot(TAKE_SCREENSHOT_FULLSCREEN, source, handler, completionConsumer); + } + + /** + * Request a screenshot be taken. + *

    + * Convenience method for taking a full screenshot with provided source. + * + * @param type type of screenshot, defined by {@link ScreenshotType} + * @param source source of the screenshot request, defined by {@link + * ScreenshotSource} + * @param handler used to process messages received from the screenshot service + * @param completionConsumer receives the URI of the captured screenshot, once saved or + * null if no screenshot was saved + */ + public void takeScreenshot(@ScreenshotType int type, @ScreenshotSource int source, + @NonNull Handler handler, @Nullable Consumer completionConsumer) { ScreenshotRequest request = - new ScreenshotRequest.Builder(TAKE_SCREENSHOT_FULLSCREEN, source).build(); + new ScreenshotRequest.Builder(type, source).build(); takeScreenshot(request, handler, completionConsumer); } diff --git a/core/java/com/android/internal/util/ScreenshotRequest.java b/core/java/com/android/internal/util/ScreenshotRequest.java index c8b7defb5276..dfef895642d3 100644 --- a/core/java/com/android/internal/util/ScreenshotRequest.java +++ b/core/java/com/android/internal/util/ScreenshotRequest.java @@ -20,6 +20,7 @@ import static android.os.UserHandle.USER_NULL; import static android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN; import static android.view.WindowManager.TAKE_SCREENSHOT_PROVIDED_IMAGE; +import static android.view.WindowManager.TAKE_SCREENSHOT_SELECTED_REGION; import android.annotation.NonNull; import android.content.ComponentName; @@ -173,7 +174,8 @@ public static class Builder { public Builder( @WindowManager.ScreenshotType int type, @WindowManager.ScreenshotSource int source) { - if (type != TAKE_SCREENSHOT_FULLSCREEN && type != TAKE_SCREENSHOT_PROVIDED_IMAGE) { + if (type != TAKE_SCREENSHOT_FULLSCREEN && type != TAKE_SCREENSHOT_PROVIDED_IMAGE + && type != TAKE_SCREENSHOT_SELECTED_REGION) { throw new IllegalArgumentException("Invalid screenshot type requested!"); } mType = type; @@ -187,6 +189,9 @@ public ScreenshotRequest build() { if (mType == TAKE_SCREENSHOT_FULLSCREEN && mBitmap != null) { Log.w(TAG, "Bitmap provided, but request is fullscreen. Bitmap will be ignored."); } + if (mType == TAKE_SCREENSHOT_SELECTED_REGION && mBitmap != null) { + Log.w(TAG, "Bitmap provided, but request is partial. Bitmap will be ignored."); + } if (mType == TAKE_SCREENSHOT_PROVIDED_IMAGE && mBitmap == null) { throw new IllegalStateException( "Request is PROVIDED_IMAGE, but no bitmap is provided!"); diff --git a/core/java/com/android/internal/util/SomeImitationHooks.java b/core/java/com/android/internal/util/SomeImitationHooks.java new file mode 100644 index 000000000000..7649c3f28e02 --- /dev/null +++ b/core/java/com/android/internal/util/SomeImitationHooks.java @@ -0,0 +1,274 @@ +/* + * Copyright (C) 2024 SomethingOS 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.internal.util; + +import android.app.Application; +import android.app.ActivityTaskManager; +import android.app.TaskStackListener; +import android.content.res.Resources; +import android.content.ComponentName; +import android.content.Context; +import android.os.SystemProperties; +import android.os.Build; +import android.os.Binder; +import android.os.Process; +import android.util.Log; +import android.text.TextUtils; + +import com.android.internal.R; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +public class SomeImitationHooks { + + private static final String TAG = "SomeImitationHooks"; + private static final boolean DEBUG = false; + + // Packages + private static final String PACKAGE_FINSKY = "com.android.vending"; + private static final String PACKAGE_GMS = "com.google.android.gms"; + private static final String PROCESS_GMS_UNSTABLE = PACKAGE_GMS + ".unstable"; + private static final String PACKAGE_GPHOTOS = "com.google.android.apps.photos"; + private static final ComponentName GMS_ADD_ACCOUNT_ACTIVITY = ComponentName.unflattenFromString( + "com.google.android.gms/.auth.uiflows.minutemaid.MinuteMaidActivity"); + + // Apps + private static volatile boolean sIsGms, sIsFinsky, sIsGPhotos; + + // Props + private static volatile boolean sUnlimitedGPhotos = SystemProperties.getBoolean("persist.sys.sih.unlimited_gphotos", false); + private static volatile boolean sPixelFeatures = SystemProperties.getBoolean("persist.sys.sih.pixel_features", false); + private static volatile boolean sIntegritySpoof = SystemProperties.getBoolean("persist.sys.sih.integrity_spoof", true); + private static volatile boolean sBlockECC = SystemProperties.getBoolean("persist.sys.sih.block_ecc", true); + + private static final String PROP_SECURITY_PATCH = "persist.sys.somethingos.gms.SECURITY_PATCH"; + private static final String PROP_FIRST_API_LEVEL = "persist.sys.somethingos.gms.PROP_FIRST_API_LEVEL"; + + // Pixels + private static final Map LatestPixelProps; + private static final Map PixelXLProps; + + // Certified props + private static final String[] certifiedProps = { + "MANUFACTURER", + "BRAND", + "DEVICE", + "MODEL", + "PRODUCT", + "FINGERPRINT", + "SECURITY_PATCH", + "FIRST_API_LEVEL" + }; + + //Pixel flags + private static final Set sGphotosFeatures = Set.of( + "NEXUS_PRELOAD", + "nexus_preload", + "PIXEL_EXPERIENCE", + "PIXEL_PRELOAD", + "PIXEL_2016_PRELOAD" + ); + + // Fill Devices + static { + LatestPixelProps = new HashMap<>(); + LatestPixelProps.put("BRAND", "google"); + LatestPixelProps.put("MANUFACTURER", "Google"); + LatestPixelProps.put("DEVICE", "caiman"); + LatestPixelProps.put("PRODUCT", "caiman"); + LatestPixelProps.put("HARDWARE", "caiman"); + LatestPixelProps.put("MODEL", "Pixel 9 Pro"); + LatestPixelProps.put("ID", "AD1A.240530.047.U1"); + LatestPixelProps.put("FINGERPRINT", "google/caiman/caiman:14/AD1A.240530.047.U1/12150698:user/release-keys"); + PixelXLProps = new HashMap<>(); + PixelXLProps.put("BRAND", "google"); + PixelXLProps.put("MANUFACTURER", "Google"); + PixelXLProps.put("DEVICE", "marlin"); + PixelXLProps.put("PRODUCT", "marlin"); + PixelXLProps.put("HARDWARE", "marlin"); + PixelXLProps.put("MODEL", "Pixel XL"); + PixelXLProps.put("ID", "QP1A.191005.007.A3"); + PixelXLProps.put("FINGERPRINT", "google/marlin/marlin:10/QP1A.191005.007.A3/5972272:user/release-keys"); + } + + // Apps by device + private static final String[] latestPixelPackages = { + "com.android.vending", + "com.google.android.apps.customization.pixel", + "com.google.android.apps.emojiwallpaper", + "com.google.android.apps.privacy.wildlife", + "com.google.android.apps.subscriptions.red", + "com.google.android.apps.wallpaper", + "com.google.android.apps.wallpaper.pixel", + "com.google.android.googlequicksearchbox", + "com.google.android.wallpaper.effects", + "com.google.android.apps.bard", + "com.google.pixel.livewallpaper", + "com.nhs.online.nhsonline", + "com.netflix.mediaclient" + }; + + // Methods + + public static void setProps(Application app) { + final String packageName = app.getPackageName(); + final String processName = app.getProcessName(); + + if (packageName == null || processName == null) { + return; + } + + sIsGms = packageName.equals(PACKAGE_GMS) && processName.equals(PROCESS_GMS_UNSTABLE); + sIsFinsky = packageName.equals(PACKAGE_FINSKY); + sIsGPhotos = packageName.equals(PACKAGE_GPHOTOS); + + if (sIsGPhotos && sUnlimitedGPhotos) { + applyProps(PixelXLProps); + } else if (sPixelFeatures && Arrays.asList(latestPixelPackages).contains(packageName)) { + applyProps(LatestPixelProps); + } else if (sIsGms && sIntegritySpoof) { + applyGMSSpoof(); + } + } + + private static void applyProps(Map props) { + for (Map.Entry prop : props.entrySet()) { + String key = prop.getKey(); + String value = prop.getValue(); + setPropValue(key, value); + } + } + + private static void setPropValue(String key, Object value){ + try { + dlog("Setting prop " + key + " to " + value.toString()); + Field field = Build.class.getDeclaredField(key); + field.setAccessible(true); + field.set(null, value); + field.setAccessible(false); + } catch (NoSuchFieldException | IllegalAccessException e) { + Log.e(TAG, "Failed to set prop " + key, e); + } + } + + private static boolean isCallerSafetyNet() { + return sIsGms && Arrays.stream(Thread.currentThread().getStackTrace()) + .anyMatch(elem -> elem.getClassName().contains("DroidGuard")); + } + + public static void onEngineGetCertificateChain() { + if ((isCallerSafetyNet() || sIsFinsky) && sBlockECC) { + dlog("Blocked key attestation sIsGms=" + sIsGms + " sIsFinsky=" + sIsFinsky); + throw new UnsupportedOperationException(); + } + } + + private static void setCertifiedProps() { + for (String key : certifiedProps) { + String value = SystemProperties.get("persist.sys.somethingos.gms." + key); + if (value != null && !value.isEmpty()) { + if (key.equals("SECURITY_PATCH")) { + setSystemProperty(PROP_SECURITY_PATCH, value); + } else if (key.equals("FIRST_API_LEVEL")) { + setSystemProperty(PROP_FIRST_API_LEVEL, value); + } else { + setPropValue(key, value); + } + } + } + } + + private static void setSystemProperty(String name, String value) { + try { + SystemProperties.set(name, value); + dlog("Set system prop " + name + "=" + value); + } catch (Exception e) { + Log.e(TAG, "Failed to set system prop " + name + "=" + value, e); + } + } + + private static void applyGMSSpoof() { + final boolean was = isGmsAddAccountActivityOnTop(); + final TaskStackListener taskStackListener = new TaskStackListener() { + @Override + public void onTaskStackChanged() { + final boolean is = isGmsAddAccountActivityOnTop(); + if (is ^ was) { + dlog("GmsAddAccountActivityOnTop is:" + is + " was:" + was + + ", killing myself!"); + Process.killProcess(Process.myPid()); + } + } + }; + if (!was) { + dlog("Spoofing build for GMS"); + setCertifiedProps(); + } else { + dlog("Skip spoofing build for GMS, because GmsAddAccountActivityOnTop"); + } + try { + ActivityTaskManager.getService().registerTaskStackListener(taskStackListener); + } catch (Exception e) { + Log.e(TAG, "Failed to register task stack listener!", e); + } + } + + public static boolean shouldBypassTaskPermission(Context context) { + if (!sIntegritySpoof) { + return false; + } + + // GMS doesn't have MANAGE_ACTIVITY_TASKS permission + final int callingUid = Binder.getCallingUid(); + final int gmsUid; + try { + gmsUid = context.getPackageManager().getApplicationInfo(PACKAGE_GMS, 0).uid; + dlog("shouldBypassTaskPermission: gmsUid:" + gmsUid + " callingUid:" + callingUid); + } catch (Exception e) { + Log.e(TAG, "shouldBypassTaskPermission: unable to get gms uid", e); + return false; + } + return gmsUid == callingUid; + } + + public static boolean hasSystemFeature(String name, boolean has) { + if (sIsGPhotos && sUnlimitedGPhotos && sGphotosFeatures.stream().anyMatch(name::contains)) { + return true; + } + return has; + } + + private static boolean isGmsAddAccountActivityOnTop() { + try { + final ActivityTaskManager.RootTaskInfo focusedTask = + ActivityTaskManager.getService().getFocusedRootTaskInfo(); + return focusedTask != null && focusedTask.topActivity != null + && focusedTask.topActivity.equals(GMS_ADD_ACCOUNT_ACTIVITY); + } catch (Exception e) { + Log.e(TAG, "Unable to get top activity!", e); + } + return false; + } + + public static void dlog(String msg) { + if (DEBUG) Log.d(TAG, msg); + } +} diff --git a/core/java/com/android/internal/util/aospa/AospaUtils.java b/core/java/com/android/internal/util/aospa/AospaUtils.java new file mode 100644 index 000000000000..ae626e5d4165 --- /dev/null +++ b/core/java/com/android/internal/util/aospa/AospaUtils.java @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2017 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.internal.util.aospa; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; +import android.content.pm.ResolveInfo; +import android.graphics.Point; +import android.graphics.Rect; +import android.hardware.input.InputManager; +import android.hardware.Sensor; +import android.hardware.SensorManager; +import android.os.Handler; +import android.os.Looper; +import android.os.PowerManager; +import android.os.RemoteException; +import android.os.ServiceManager; +import android.os.SystemClock; +import android.view.Display; +import android.view.DisplayCutout; +import android.view.InputDevice; +import android.view.IWindowManager; +import android.view.KeyCharacterMap; +import android.view.KeyEvent; +import android.view.WindowManagerGlobal; +import android.view.Surface; + +import com.android.internal.statusbar.IStatusBarService; + +import java.util.ArrayList; +import java.util.List; + +/** + * Some custom utilities + */ +public class AospaUtils { + + // Check to see if a package is installed + public static boolean isPackageInstalled(Context context, String pkg, boolean ignoreState) { + if (pkg != null) { + try { + PackageInfo pi = context.getPackageManager().getPackageInfo(pkg, 0); + if (!pi.applicationInfo.enabled && !ignoreState) { + return false; + } + } catch (NameNotFoundException e) { + return false; + } + } + + return true; + } + + public static boolean isPackageInstalled(Context context, String pkg) { + return isPackageInstalled(context, pkg, true); + } + + public static List launchablePackages(Context context) { + List list = new ArrayList<>(); + + Intent filter = new Intent(Intent.ACTION_MAIN, null); + filter.addCategory(Intent.CATEGORY_LAUNCHER); + + List apps = context.getPackageManager().queryIntentActivities(filter, + PackageManager.GET_META_DATA); + + int numPackages = apps.size(); + for (int i = 0; i < numPackages; i++) { + ResolveInfo app = apps.get(i); + list.add(app.activityInfo.packageName); + } + + return list; + } + + /* returns whether the device has a centered display cutout or not. */ + public static boolean hasCenteredCutout(Context context) { + Display display = context.getDisplay(); + DisplayCutout cutout = display.getCutout(); + if (cutout != null) { + Point realSize = new Point(); + display.getRealSize(realSize); + + switch (display.getRotation()) { + case Surface.ROTATION_0: { + Rect rect = cutout.getBoundingRectTop(); + return !(rect.left <= 0 || rect.right >= realSize.x); + } + case Surface.ROTATION_90: { + Rect rect = cutout.getBoundingRectLeft(); + return !(rect.top <= 0 || rect.bottom >= realSize.y); + } + case Surface.ROTATION_180: { + Rect rect = cutout.getBoundingRectBottom(); + return !(rect.left <= 0 || rect.right >= realSize.x); + } + case Surface.ROTATION_270: { + Rect rect = cutout.getBoundingRectRight(); + return !(rect.top <= 0 || rect.bottom >= realSize.y); + } + } + } + return false; + } +} diff --git a/core/java/com/android/internal/util/aospa/PowerMenuConstants.java b/core/java/com/android/internal/util/aospa/PowerMenuConstants.java new file mode 100644 index 000000000000..3417e95231d2 --- /dev/null +++ b/core/java/com/android/internal/util/aospa/PowerMenuConstants.java @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * Copyright (C) 2017-2022 The LineageOS 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.internal.util.aospa; + +/* Master list of all actions for the power menu */ +public class PowerMenuConstants { + public static final String GLOBAL_ACTION_KEY_POWER = "power"; + public static final String GLOBAL_ACTION_KEY_RESTART = "restart"; + public static final String GLOBAL_ACTION_KEY_SCREENSHOT = "screenshot"; + public static final String GLOBAL_ACTION_KEY_AIRPLANE = "airplane"; + public static final String GLOBAL_ACTION_KEY_USERS = "users"; + public static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; + public static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; + public static final String GLOBAL_ACTION_KEY_BUGREPORT = "bugreport"; + public static final String GLOBAL_ACTION_KEY_SILENT = "silent"; + public static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist"; + public static final String GLOBAL_ACTION_KEY_ASSIST = "assist"; + public static final String GLOBAL_ACTION_KEY_LOGOUT = "logout"; + public static final String GLOBAL_ACTION_KEY_EMERGENCY = "emergency"; + public static final String GLOBAL_ACTION_KEY_DEVICECONTROLS = "devicecontrols"; + public static final String GLOBAL_ACTION_KEY_SYSTEM_UPDATE = "system_update"; + public static final String GLOBAL_ACTION_KEY_RESTART_SYSTEMUI = "restart_systemui"; + + /** + * Advanced restart menu actions + */ + public static final String GLOBAL_ACTION_KEY_RESTART_RECOVERY = "restart_recovery"; + public static final String GLOBAL_ACTION_KEY_RESTART_BOOTLOADER = "restart_bootloader"; + public static final String GLOBAL_ACTION_KEY_RESTART_DOWNLOAD = "restart_download"; + public static final String GLOBAL_ACTION_KEY_RESTART_FASTBOOT = "restart_fastboot"; + + private static String[] ALL_ACTIONS = { + GLOBAL_ACTION_KEY_EMERGENCY, + GLOBAL_ACTION_KEY_LOCKDOWN, + GLOBAL_ACTION_KEY_POWER, + GLOBAL_ACTION_KEY_RESTART, + GLOBAL_ACTION_KEY_SCREENSHOT, + GLOBAL_ACTION_KEY_AIRPLANE, + GLOBAL_ACTION_KEY_USERS, + GLOBAL_ACTION_KEY_SETTINGS, + GLOBAL_ACTION_KEY_BUGREPORT, + GLOBAL_ACTION_KEY_SILENT, + GLOBAL_ACTION_KEY_VOICEASSIST, + GLOBAL_ACTION_KEY_ASSIST, + GLOBAL_ACTION_KEY_DEVICECONTROLS, + GLOBAL_ACTION_KEY_RESTART_SYSTEMUI, + GLOBAL_ACTION_KEY_LOGOUT, + GLOBAL_ACTION_KEY_SYSTEM_UPDATE, + }; + + public static String[] getAllActions() { + return ALL_ACTIONS; + } +} diff --git a/core/java/com/android/internal/util/aospa/PowerMenuUtils.java b/core/java/com/android/internal/util/aospa/PowerMenuUtils.java new file mode 100644 index 000000000000..4c7070e09852 --- /dev/null +++ b/core/java/com/android/internal/util/aospa/PowerMenuUtils.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017 The LineageOS 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.internal.util.aospa; + +import android.app.KeyguardManager; +import android.content.Context; +import android.os.UserHandle; + +import android.provider.Settings; + +public final class PowerMenuUtils { + public static boolean isAdvancedRestartPossible(final Context context) { + KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); + boolean keyguardLocked = km.inKeyguardRestrictedInputMode() && km.isKeyguardSecure(); + boolean advancedRestartEnabled = Settings.Secure.getInt(context.getContentResolver(), + Settings.Secure.ADVANCED_REBOOT, 0) == 1; + boolean isPrimaryUser = UserHandle.getCallingUserId() == UserHandle.USER_SYSTEM; + + return advancedRestartEnabled && !keyguardLocked && isPrimaryUser; + } +} diff --git a/core/res/res/drawable/stat_sys_network_traffic_down.xml b/core/res/res/drawable/stat_sys_network_traffic_down.xml new file mode 100644 index 000000000000..4e0efe6e1851 --- /dev/null +++ b/core/res/res/drawable/stat_sys_network_traffic_down.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/core/res/res/drawable/stat_sys_network_traffic_up.xml b/core/res/res/drawable/stat_sys_network_traffic_up.xml new file mode 100644 index 000000000000..12091f3b6d04 --- /dev/null +++ b/core/res/res/drawable/stat_sys_network_traffic_up.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/core/res/res/drawable/stat_sys_network_traffic_updown.xml b/core/res/res/drawable/stat_sys_network_traffic_updown.xml new file mode 100644 index 000000000000..80336ab407d9 --- /dev/null +++ b/core/res/res/drawable/stat_sys_network_traffic_updown.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/core/res/res/values/aospa_config.xml b/core/res/res/values/aospa_config.xml index b088aad7fc38..9e7fd7b5ffea 100644 --- a/core/res/res/values/aospa_config.xml +++ b/core/res/res/values/aospa_config.xml @@ -95,4 +95,11 @@ false + + + restart + restart_recovery + restart_bootloader + + diff --git a/core/res/res/values/aospa_dimens.xml b/core/res/res/values/aospa_dimens.xml index 55540afa525c..4495e373a2c3 100644 --- a/core/res/res/values/aospa_dimens.xml +++ b/core/res/res/values/aospa_dimens.xml @@ -29,4 +29,8 @@ 14sp 8dp + + 14sp + 8sp + diff --git a/core/res/res/values/aospa_strings.xml b/core/res/res/values/aospa_strings.xml index 904d2d03c03a..e20ab0700d57 100644 --- a/core/res/res/values/aospa_strings.xml +++ b/core/res/res/values/aospa_strings.xml @@ -36,4 +36,12 @@ 1. Ensure the green area (proximity sensor) shown above is unobstructed and free from dirt or dust. 2. Press and hold the power button to exit pocket mode. + + kb/s + Mb/s + kB/s + MB/s + k + M + diff --git a/core/res/res/values/aospa_symbols.xml b/core/res/res/values/aospa_symbols.xml index 92959676c99d..f123d6e19a4b 100644 --- a/core/res/res/values/aospa_symbols.xml +++ b/core/res/res/values/aospa_symbols.xml @@ -70,4 +70,20 @@ + + + + + + + + + + + + + + + + diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 8fc432f67155..beabcb9060f7 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3554,7 +3554,7 @@ - 1.0 + 0.8 emergency @@ -3672,7 +3673,8 @@ restart logout screenshot - bugreport + + restart_systemui + + + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/color/xd_base_layout_header.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/color/xd_base_layout_header.xml new file mode 100644 index 000000000000..49111c73201c --- /dev/null +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/color/xd_base_layout_header.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_back_arrow.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_back_arrow.xml new file mode 100644 index 000000000000..5b827a063164 --- /dev/null +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_back_arrow.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_base_layout_round_mask.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_base_layout_round_mask.xml new file mode 100644 index 000000000000..433ceb369e35 --- /dev/null +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/drawable/xd_base_layout_round_mask.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/layout-v31/collapsing_toolbar_content_layout.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/layout-v31/collapsing_toolbar_content_layout.xml index 9848749e2d1c..f6b3eec8da69 100644 --- a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/layout-v31/collapsing_toolbar_content_layout.xml +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/layout-v31/collapsing_toolbar_content_layout.xml @@ -14,42 +14,84 @@ See the License for the specific language governing permissions and limitations under the License. --> - + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@id/content_parent" + android:fitsSystemWindows="true" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> - \ No newline at end of file + app:layout_behavior="@string/appbar_scrolling_view_behavior" > + + + + + + + + + + + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-night-v31/colors.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-night-v31/colors.xml new file mode 100644 index 000000000000..acd6d8ec36e4 --- /dev/null +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-night-v31/colors.xml @@ -0,0 +1,15 @@ + + + + @android:color/system_surface_container_dark + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/colors.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/colors.xml new file mode 100644 index 000000000000..da01faa9d8c3 --- /dev/null +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/colors.xml @@ -0,0 +1,16 @@ + + + + + @android:color/system_surface_container_light + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/dimens.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/dimens.xml index 40b9fcd79d49..ca72009f4ec0 100644 --- a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/dimens.xml +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/dimens.xml @@ -21,4 +21,15 @@ 24dp 24dp 32dp - \ No newline at end of file + + + 28dp + 5dp + 10dp + -10dp + + + 145dp + 24dp + 24dp + diff --git a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml index afd0d76ad468..f25bc687e2d9 100644 --- a/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml +++ b/packages/SettingsLib/CollapsingToolbarBaseActivity/res/values-v31/styles.xml @@ -41,4 +41,17 @@ @color/settingslib_text_color_primary_device_default @color/settingslib_text_color_primary_device_default - \ No newline at end of file + + + + + + + diff --git a/packages/SettingsLib/IllustrationPreference/res/drawable/protection_background.xml b/packages/SettingsLib/IllustrationPreference/res/drawable/protection_background.xml index a027f287a0aa..2a1f38507bdf 100644 --- a/packages/SettingsLib/IllustrationPreference/res/drawable/protection_background.xml +++ b/packages/SettingsLib/IllustrationPreference/res/drawable/protection_background.xml @@ -18,7 +18,7 @@ - + diff --git a/packages/SettingsLib/IllustrationPreference/res/values-night/colors.xml b/packages/SettingsLib/IllustrationPreference/res/values-night/colors.xml index 71b18a8814bc..edf434f08dd8 100644 --- a/packages/SettingsLib/IllustrationPreference/res/values-night/colors.xml +++ b/packages/SettingsLib/IllustrationPreference/res/values-night/colors.xml @@ -16,5 +16,5 @@ --> - @android:color/black + diff --git a/packages/SettingsLib/SettingsTheme/res/drawable-v34/custom_inner_preference_background.xml b/packages/SettingsLib/SettingsTheme/res/drawable-v34/custom_inner_preference_background.xml new file mode 100644 index 000000000000..1822ee54cc73 --- /dev/null +++ b/packages/SettingsLib/SettingsTheme/res/drawable-v34/custom_inner_preference_background.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/SettingsLib/SettingsTheme/res/layout-v33/settingslib_category_preference.xml b/packages/SettingsLib/SettingsTheme/res/layout-v33/settingslib_category_preference.xml new file mode 100644 index 000000000000..8afef8ca06d2 --- /dev/null +++ b/packages/SettingsLib/SettingsTheme/res/layout-v33/settingslib_category_preference.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + diff --git a/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml b/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml index 0a36a4fa035f..7654a1baa1ef 100644 --- a/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml +++ b/packages/SettingsLib/SettingsTheme/res/values-night-v31/colors.xml @@ -39,7 +39,7 @@ @android:color/system_neutral1_700 - @android:color/system_neutral1_700 + @android:color/system_neutral1_900 @@ -56,4 +56,4 @@ @color/settingslib_surface_dark - \ No newline at end of file + diff --git a/packages/SettingsLib/SettingsTheme/res/values-night-v34/ui_colors.xml b/packages/SettingsLib/SettingsTheme/res/values-night-v34/ui_colors.xml new file mode 100755 index 000000000000..0d29a6bea071 --- /dev/null +++ b/packages/SettingsLib/SettingsTheme/res/values-night-v34/ui_colors.xml @@ -0,0 +1,19 @@ + + + + + @*android:color/system_neutral1_800 + diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml index 7706e0e8a296..260af577b16b 100644 --- a/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml +++ b/packages/SettingsLib/SettingsTheme/res/values-v31/colors.xml @@ -45,7 +45,7 @@ @android:color/system_neutral2_100 - @android:color/system_neutral1_100 + @android:color/system_neutral1_50 @android:color/system_accent1_100 diff --git a/packages/SettingsLib/SettingsTheme/res/values-v31/style_preference.xml b/packages/SettingsLib/SettingsTheme/res/values-v31/style_preference.xml index a9534c3d5ca6..5b2a35ed4730 100644 --- a/packages/SettingsLib/SettingsTheme/res/values-v31/style_preference.xml +++ b/packages/SettingsLib/SettingsTheme/res/values-v31/style_preference.xml @@ -40,6 +40,7 @@ @bool/settingslib_config_icon_space_reserved @bool/settingslib_config_allow_divider @bool/settingslib_config_allow_divider + @layout/settingslib_category_preference