Merge "When data switches during voice call, make sure signal bar updates it." into qt-dev
diff --git a/cmds/incident_helper/src/main.cpp b/cmds/incident_helper/src/main.cpp
index 809a771..ff5fd86 100644
--- a/cmds/incident_helper/src/main.cpp
+++ b/cmds/incident_helper/src/main.cpp
@@ -72,6 +72,8 @@
return new PsParser();
case 2006:
return new BatteryTypeParser();
+ case 3026: // system_trace is already a serialized protobuf
+ return new NoopParser();
default:
// Return no op parser when no specific ones are implemented.
return new NoopParser();
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 85c5a20..1572114 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -67,6 +67,8 @@
switch (sectionId) {
case 3025: // restricted_images
return true;
+ case 3026: // system_trace
+ return true;
default:
return false;
}
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index 833bb8f..ce1942c 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -33,11 +33,13 @@
import dalvik.system.VMRuntime;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -72,16 +74,19 @@
"android.app.action.ANGLE_FOR_ANDROID_TOAST_MESSAGE";
private static final String INTENT_KEY_A4A_TOAST_MESSAGE = "A4A Toast Message";
private static final String GAME_DRIVER_WHITELIST_ALL = "*";
+ private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
private static final int VULKAN_1_0 = 0x00400000;
private static final int VULKAN_1_1 = 0x00401000;
// GAME_DRIVER_ALL_APPS
// 0: Default (Invalid values fallback to default as well)
// 1: All apps use Game Driver
- // 2: All apps use system graphics driver
+ // 2: All apps use Prerelease Driver
+ // 3: All apps use system graphics driver
private static final int GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT = 0;
- private static final int GAME_DRIVER_GLOBAL_OPT_IN_ALL = 1;
- private static final int GAME_DRIVER_GLOBAL_OPT_IN_NONE = 2;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER = 1;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER = 2;
+ private static final int GAME_DRIVER_GLOBAL_OPT_IN_OFF = 3;
private ClassLoader mClassLoader;
private String mLayerPath;
@@ -714,15 +719,19 @@
// 4. GAME_DRIVER_OPT_IN_APPS
// 5. GAME_DRIVER_BLACKLIST
// 6. GAME_DRIVER_WHITELIST
- final int globalOptIn = coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0);
- if (globalOptIn == GAME_DRIVER_GLOBAL_OPT_IN_NONE) {
- if (DEBUG) Log.v(TAG, "Game Driver is turned off on this device.");
- return null;
- }
-
- if (globalOptIn == GAME_DRIVER_GLOBAL_OPT_IN_ALL) {
- if (DEBUG) Log.v(TAG, "All apps opt in to use Game Driver.");
- return hasGameDriver ? gameDriver : null;
+ switch (coreSettings.getInt(Settings.Global.GAME_DRIVER_ALL_APPS, 0)) {
+ case GAME_DRIVER_GLOBAL_OPT_IN_OFF:
+ if (DEBUG) Log.v(TAG, "Game Driver is turned off on this device.");
+ return null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_GAME_DRIVER:
+ if (DEBUG) Log.v(TAG, "All apps opt in to use Game Driver.");
+ return hasGameDriver ? gameDriver : null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_PRERELEASE_DRIVER:
+ if (DEBUG) Log.v(TAG, "All apps opt in to use prerelease driver.");
+ return hasPrereleaseDriver ? prereleaseDriver : null;
+ case GAME_DRIVER_GLOBAL_OPT_IN_DEFAULT:
+ default:
+ break;
}
final String appPackageName = ai.packageName;
@@ -816,10 +825,7 @@
.append("!/lib/")
.append(abi);
final String paths = sb.toString();
-
- final String sphalLibraries =
- coreSettings.getString(Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES);
-
+ final String sphalLibraries = getSphalLibraries(context, driverPackageName);
if (DEBUG) {
Log.v(TAG,
"gfx driver package search path: " + paths
@@ -856,6 +862,29 @@
return null;
}
+ private static String getSphalLibraries(Context context, String driverPackageName) {
+ try {
+ final Context driverContext =
+ context.createPackageContext(driverPackageName, Context.CONTEXT_RESTRICTED);
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(
+ driverContext.getAssets().open(GAME_DRIVER_SPHAL_LIBRARIES_FILENAME)));
+ final ArrayList<String> assetStrings = new ArrayList<>();
+ for (String assetString; (assetString = reader.readLine()) != null;) {
+ assetStrings.add(assetString);
+ }
+ return String.join(":", assetStrings);
+ } catch (PackageManager.NameNotFoundException e) {
+ if (DEBUG) {
+ Log.w(TAG, "Driver package '" + driverPackageName + "' not installed");
+ }
+ } catch (IOException e) {
+ if (DEBUG) {
+ Log.w(TAG, "Failed to load '" + GAME_DRIVER_SPHAL_LIBRARIES_FILENAME + "'");
+ }
+ }
+ return "";
+ }
+
private static native int getCanLoadSystemLibraries();
private static native void setLayerPaths(ClassLoader classLoader, String layerPaths);
private static native void setDebugLayers(String layers);
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index c2e37d5..3a7caa4 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3609,8 +3609,8 @@
public void createFakeHistoryEvents(long numEvents) {
for(long i = 0; i < numEvents; i++) {
- noteWifiOnLocked();
- noteWifiOffLocked();
+ noteLongPartialWakelockStart("name1", "historyName1", 1000);
+ noteLongPartialWakelockFinish("name1", "historyName1", 1000);
}
}
@@ -3693,9 +3693,10 @@
mHistoryBufferLastPos = -1;
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
+ HistoryItem newItem = new HistoryItem();
+ newItem.setTo(cur);
startRecordingHistory(elapsedRealtime, uptime, false);
-
- addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, cur);
+ addHistoryBufferLocked(elapsedRealtimeMs, HistoryItem.CMD_UPDATE, newItem);
return;
}
diff --git a/core/jni/android_os_Trace.cpp b/core/jni/android_os_Trace.cpp
index 81428dc..bd82bd9 100644
--- a/core/jni/android_os_Trace.cpp
+++ b/core/jni/android_os_Trace.cpp
@@ -24,26 +24,29 @@
namespace android {
-inline static void sanitizeString(char* str, size_t size) {
- for (size_t i = 0; i < size; i++) {
- char c = str[i];
- if (c == '\0' || c == '\n' || c == '|') {
- str[i] = ' ';
+inline static void sanitizeString(char* str) {
+ while (*str) {
+ char c = *str;
+ if (c == '\n' || c == '|') {
+ *str = ' ';
}
+ str++;
}
}
-inline static void getString(JNIEnv* env, jstring jstring, char* outBuffer, jsize maxSize) {
- jsize size = std::min(env->GetStringLength(jstring), maxSize);
- env->GetStringUTFRegion(jstring, 0, size, outBuffer);
- sanitizeString(outBuffer, size);
- outBuffer[size] = '\0';
-}
-
template<typename F>
inline static void withString(JNIEnv* env, jstring jstr, F callback) {
- std::array<char, 1024> buffer;
- getString(env, jstr, buffer.data(), buffer.size());
+ // We need to handle the worst case of 1 character -> 4 bytes
+ // So make a buffer of size 4097 and let it hold a string with a maximum length
+ // of 1024. The extra last byte for the null terminator.
+ std::array<char, 4097> buffer;
+ // We have no idea of knowing how much data GetStringUTFRegion wrote, so null it out in
+ // advance so we can have a reliable null terminator
+ memset(buffer.data(), 0, buffer.size());
+ jsize size = std::min(env->GetStringLength(jstr), 1024);
+ env->GetStringUTFRegion(jstr, 0, size, buffer.data());
+ sanitizeString(buffer.data());
+
callback(buffer.data());
}
diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto
index 9a9c9d1..7d0629e 100644
--- a/core/proto/android/os/incident.proto
+++ b/core/proto/android/os/incident.proto
@@ -321,6 +321,14 @@
(section).args = "incidentcompanion --restricted_image"
];
+ // System trace as a serialized protobuf.
+ optional bytes system_trace = 3026 [
+ (section).type = SECTION_FILE,
+ (section).args = "/data/misc/perfetto-traces/incident-trace",
+ (privacy).dest = DEST_AUTOMATIC,
+ (section).userdebug_and_eng_only = true
+ ];
+
// Reserved for OEMs.
extensions 50000 to 100000;
}
diff --git a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
index d3eb9ae..eabc5c5 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_section_header.xml
@@ -49,6 +49,7 @@
android:text="@string/notification_section_header_gentle"
android:textSize="12sp"
android:textColor="@color/notification_section_header_label_color"
+ android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
/>
<ImageView
android:id="@+id/btn_clear_all"
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
index bd7b3d5..9ba21a3 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java
@@ -22,6 +22,7 @@
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Message;
+import android.os.Trace;
import android.view.Surface;
import android.view.View;
import android.view.ViewRootImpl;
@@ -95,6 +96,7 @@
.sendToTarget();
return;
}
+ Trace.traceBegin(Trace.TRACE_TAG_VIEW, "Sync transaction frameNumber=" + frame);
TransactionCompat t = new TransactionCompat();
for (int i = params.length - 1; i >= 0; i--) {
SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams =
@@ -105,6 +107,7 @@
}
t.setEarlyWakeup();
t.apply();
+ Trace.traceEnd(Trace.TRACE_TAG_VIEW);
Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
.sendToTarget();
}
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
index 87fb28b..909b68b 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistHandleReminderExpBehavior.java
@@ -16,14 +16,13 @@
package com.android.systemui.assist;
-import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
-
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
import android.os.Handler;
import android.os.SystemClock;
import android.provider.Settings;
@@ -44,6 +43,7 @@
import java.io.PrintWriter;
import java.time.LocalDate;
import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@@ -68,6 +68,14 @@
private static final boolean DEFAULT_SUPPRESS_ON_LAUNCHER = false;
private static final boolean DEFAULT_SUPPRESS_ON_APPS = false;
+ private static final String[] DEFAULT_HOME_CHANGE_ACTIONS = new String[] {
+ PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED,
+ Intent.ACTION_BOOT_COMPLETED,
+ Intent.ACTION_PACKAGE_ADDED,
+ Intent.ACTION_PACKAGE_CHANGED,
+ Intent.ACTION_PACKAGE_REMOVED
+ };
+
private final StatusBarStateController.StateListener mStatusBarStateListener =
new StatusBarStateController.StateListener() {
@Override
@@ -110,8 +118,7 @@
mDefaultHome = getCurrentDefaultHome();
}
};
- private final IntentFilter mDefaultHomeIntentFilter =
- new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED);
+ private final IntentFilter mDefaultHomeIntentFilter;
private final Runnable mResetConsecutiveTaskSwitches = this::resetConsecutiveTaskSwitches;
private final Handler mHandler;
@@ -146,6 +153,10 @@
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mActivityManagerWrapper = ActivityManagerWrapper.getInstance();
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
+ mDefaultHomeIntentFilter = new IntentFilter();
+ for (String action : DEFAULT_HOME_CHANGE_ACTIONS) {
+ mDefaultHomeIntentFilter.addAction(action);
+ }
}
@Override
@@ -205,7 +216,24 @@
@Nullable
private static ComponentName getCurrentDefaultHome() {
- return PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ List<ResolveInfo> homeActivities = new ArrayList<>();
+ ComponentName defaultHome =
+ PackageManagerWrapper.getInstance().getHomeActivities(homeActivities);
+ if (defaultHome != null) {
+ return defaultHome;
+ }
+
+ int topPriority = Integer.MIN_VALUE;
+ ComponentName topComponent = null;
+ for (ResolveInfo resolveInfo : homeActivities) {
+ if (resolveInfo.priority > topPriority) {
+ topComponent = resolveInfo.activityInfo.getComponentName();
+ topPriority = resolveInfo.priority;
+ } else if (resolveInfo.priority == topPriority) {
+ topComponent = null;
+ }
+ }
+ return topComponent;
}
private void handleStatusBarStateChanged(int newState) {
diff --git a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
index 1fd3089..e73dc4a 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/PhoneStateMonitor.java
@@ -16,8 +16,6 @@
package com.android.systemui.assist;
-import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
-
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
@@ -25,6 +23,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
import androidx.annotation.Nullable;
@@ -38,6 +37,7 @@
import com.android.systemui.statusbar.phone.StatusBar;
import java.util.ArrayList;
+import java.util.List;
/** Class to monitor and report the state of the phone. */
final class PhoneStateMonitor {
@@ -53,6 +53,14 @@
private static final int PHONE_STATE_APP_IMMERSIVE = 9;
private static final int PHONE_STATE_APP_FULLSCREEN = 10;
+ private static final String[] DEFAULT_HOME_CHANGE_ACTIONS = new String[] {
+ PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED,
+ Intent.ACTION_BOOT_COMPLETED,
+ Intent.ACTION_PACKAGE_ADDED,
+ Intent.ACTION_PACKAGE_CHANGED,
+ Intent.ACTION_PACKAGE_REMOVED
+ };
+
private final Context mContext;
private final StatusBarStateController mStatusBarStateController;
@@ -64,14 +72,17 @@
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
ActivityManagerWrapper activityManagerWrapper = ActivityManagerWrapper.getInstance();
- mDefaultHome = PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ mDefaultHome = getCurrentDefaultHome();
+ IntentFilter intentFilter = new IntentFilter();
+ for (String action : DEFAULT_HOME_CHANGE_ACTIONS) {
+ intentFilter.addAction(action);
+ }
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- mDefaultHome =
- PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>());
+ mDefaultHome = getCurrentDefaultHome();
}
- }, new IntentFilter(ACTION_PREFERRED_ACTIVITY_CHANGED));
+ }, intentFilter);
mLauncherShowing = isLauncherShowing(activityManagerWrapper.getRunningTask());
activityManagerWrapper.registerTaskStackListener(new TaskStackChangeListener() {
@Override
@@ -93,6 +104,28 @@
return phoneState;
}
+ @Nullable
+ private static ComponentName getCurrentDefaultHome() {
+ List<ResolveInfo> homeActivities = new ArrayList<>();
+ ComponentName defaultHome =
+ PackageManagerWrapper.getInstance().getHomeActivities(homeActivities);
+ if (defaultHome != null) {
+ return defaultHome;
+ }
+
+ int topPriority = Integer.MIN_VALUE;
+ ComponentName topComponent = null;
+ for (ResolveInfo resolveInfo : homeActivities) {
+ if (resolveInfo.priority > topPriority) {
+ topComponent = resolveInfo.activityInfo.getComponentName();
+ topPriority = resolveInfo.priority;
+ } else if (resolveInfo.priority == topPriority) {
+ topComponent = null;
+ }
+ }
+ return topComponent;
+ }
+
private int getPhoneLockscreenState() {
if (isDozing()) {
return PHONE_STATE_AOD1;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
index f5016da..6bbeffa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FloatingRotationButton.java
@@ -16,8 +16,10 @@
package com.android.systemui.statusbar.phone;
+import android.annotation.ColorInt;
import android.content.Context;
import android.content.res.Resources;
+import android.graphics.Color;
import android.graphics.PixelFormat;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
@@ -26,6 +28,7 @@
import android.view.View;
import android.view.WindowManager;
+import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
import com.android.systemui.statusbar.policy.KeyButtonView;
@@ -33,6 +36,8 @@
/** Containing logic for the rotation button on the physical left bottom corner of the screen. */
public class FloatingRotationButton implements RotationButton {
+ private static final float BACKGROUND_ALPHA = 0.92f;
+
private final Context mContext;
private final WindowManager mWindowManager;
private final KeyButtonView mKeyButtonView;
@@ -151,8 +156,18 @@
public KeyButtonDrawable getImageDrawable() {
Context context = new ContextThemeWrapper(mContext.getApplicationContext(),
mRotationButtonController.getStyleRes());
- return KeyButtonDrawable.create(context, R.drawable.ic_sysbar_rotate_button,
- false /* shadow */, true /* hasOvalBg */);
+ final int dualToneDarkTheme = Utils.getThemeAttr(context, R.attr.darkIconTheme);
+ final int dualToneLightTheme = Utils.getThemeAttr(context, R.attr.lightIconTheme);
+ Context lightContext = new ContextThemeWrapper(context, dualToneLightTheme);
+ Context darkContext = new ContextThemeWrapper(context, dualToneDarkTheme);
+ @ColorInt int darkColor = Utils.getColorAttrDefaultColor(darkContext,
+ R.attr.singleToneColor);
+ Color ovalBackgroundColor = Color.valueOf(Color.red(darkColor), Color.green(darkColor),
+ Color.blue(darkColor), BACKGROUND_ALPHA);
+
+ return KeyButtonDrawable.create(lightContext,
+ Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor), darkColor,
+ R.drawable.ic_sysbar_rotate_button, false /* shadow */, ovalBackgroundColor);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
index b117dec..24e7336 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/RotationContextButton.java
@@ -24,7 +24,6 @@
import android.view.ContextThemeWrapper;
import android.view.View;
-import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
/** Containing logic for the rotation button in nav bar. */
@@ -61,7 +60,7 @@
Context context = new ContextThemeWrapper(getContext().getApplicationContext(),
mRotationButtonController.getStyleRes());
return KeyButtonDrawable.create(context, mIconResId, false /* shadow */,
- QuickStepContract.isGesturalMode(mNavBarMode));
+ null /* ovalBackgroundColor */);
}
@Override
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 80fbda0..1fdabc0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -317,17 +317,6 @@
/** If true, the lockscreen will show a distinct wallpaper */
public static final boolean ENABLE_LOCKSCREEN_WALLPAPER = true;
- private static final AudioAttributes AUDIO_ATTRIBUTES =
- new AudioAttributes.Builder()
- .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- // Temporary fix for b/123870990. No time in this release to
- // introduce a new vibration type, but we need to distinguish these vibrations
- // from other haptic feedback vibrations. Fortunately, Alarm vibrations have
- // exactly the same behavior as we need
- // TODO: refactor within the scope of b/132170758
- .setUsage(AudioAttributes.USAGE_ALARM)
- .build();
-
static {
boolean onlyCoreApps;
try {
@@ -3699,7 +3688,7 @@
private void vibrateForCameraGesture() {
// Make sure to pass -1 for repeat so VibratorService doesn't stop us when going to sleep.
- mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */, AUDIO_ATTRIBUTES);
+ mVibrator.vibrate(mCameraLaunchGestureVibePattern, -1 /* repeat */);
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
index 568de63..8fcaa67 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonDrawable.java
@@ -82,9 +82,9 @@
private AnimatedVectorDrawable mAnimatedDrawable;
public KeyButtonDrawable(Drawable d, @ColorInt int lightColor, @ColorInt int darkColor,
- boolean horizontalFlip, boolean hasOvalBg) {
+ boolean horizontalFlip, Color ovalBackgroundColor) {
this(d, new ShadowDrawableState(lightColor, darkColor,
- d instanceof AnimatedVectorDrawable, horizontalFlip, hasOvalBg));
+ d instanceof AnimatedVectorDrawable, horizontalFlip, ovalBackgroundColor));
}
private KeyButtonDrawable(Drawable d, ShadowDrawableState state) {
@@ -166,7 +166,7 @@
public void setColorFilter(ColorFilter colorFilter) {
mIconPaint.setColorFilter(colorFilter);
if (mAnimatedDrawable != null) {
- if (mState.mHasOvalBg) {
+ if (hasOvalBg()) {
mAnimatedDrawable.setColorFilter(
new PorterDuffColorFilter(mState.mLightColor, PorterDuff.Mode.SRC_IN));
} else {
@@ -212,15 +212,6 @@
return mState.mBaseWidth + (mState.mShadowSize + Math.abs(mState.mShadowOffsetX)) * 2;
}
- /** Return if the drawable has oval background. */
- public boolean hasOvalBg() {
- return mState.mHasOvalBg;
- }
-
- public int getDarkColor() {
- return mState.mDarkColor;
- }
-
public boolean canAnimate() {
return mState.mSupportsAnimation;
}
@@ -290,6 +281,14 @@
return mState.canApplyTheme();
}
+ @ColorInt int getDrawableBackgroundColor() {
+ return mState.mOvalBackgroundColor.toArgb();
+ }
+
+ boolean hasOvalBg() {
+ return mState.mOvalBackgroundColor != null;
+ }
+
private void regenerateBitmapIconCache() {
final int width = getIntrinsicWidth();
final int height = getIntrinsicHeight();
@@ -394,16 +393,16 @@
final int mLightColor;
final int mDarkColor;
final boolean mSupportsAnimation;
- final boolean mHasOvalBg;
+ final Color mOvalBackgroundColor;
public ShadowDrawableState(@ColorInt int lightColor, @ColorInt int darkColor,
- boolean animated, boolean horizontalFlip, boolean hasOvalBg) {
+ boolean animated, boolean horizontalFlip, Color ovalBackgroundColor) {
mLightColor = lightColor;
mDarkColor = darkColor;
mSupportsAnimation = animated;
mAlpha = 255;
mHorizontalFlip = horizontalFlip;
- mHasOvalBg = hasOvalBg;
+ mOvalBackgroundColor = ovalBackgroundColor;
}
@Override
@@ -428,16 +427,17 @@
* @param ctx Context to get the drawable and determine the dark and light theme
* @param icon the icon resource id
* @param hasShadow if a shadow will appear with the drawable
- * @param hasOvalBg if an oval bg will be drawn
+ * @param ovalBackgroundColor the color of the oval bg that will be drawn
* @return KeyButtonDrawable
*/
public static KeyButtonDrawable create(@NonNull Context ctx, @DrawableRes int icon,
- boolean hasShadow, boolean hasOvalBg) {
+ boolean hasShadow, Color ovalBackgroundColor) {
final int dualToneDarkTheme = Utils.getThemeAttr(ctx, R.attr.darkIconTheme);
final int dualToneLightTheme = Utils.getThemeAttr(ctx, R.attr.lightIconTheme);
Context lightContext = new ContextThemeWrapper(ctx, dualToneLightTheme);
Context darkContext = new ContextThemeWrapper(ctx, dualToneDarkTheme);
- return KeyButtonDrawable.create(lightContext, darkContext, icon, hasShadow, hasOvalBg);
+ return KeyButtonDrawable.create(lightContext, darkContext, icon, hasShadow,
+ ovalBackgroundColor);
}
/**
@@ -446,7 +446,7 @@
*/
public static KeyButtonDrawable create(@NonNull Context ctx, @DrawableRes int icon,
boolean hasShadow) {
- return create(ctx, icon, hasShadow, false /* hasOvalBg */);
+ return create(ctx, icon, hasShadow, null /* ovalBackgroundColor */);
}
/**
@@ -454,11 +454,11 @@
* {@link #create(Context, int, boolean, boolean)}.
*/
public static KeyButtonDrawable create(Context lightContext, Context darkContext,
- @DrawableRes int iconResId, boolean hasShadow, boolean hasOvalBg) {
+ @DrawableRes int iconResId, boolean hasShadow, Color ovalBackgroundColor) {
return create(lightContext,
Utils.getColorAttrDefaultColor(lightContext, R.attr.singleToneColor),
Utils.getColorAttrDefaultColor(darkContext, R.attr.singleToneColor),
- iconResId, hasShadow, hasOvalBg);
+ iconResId, hasShadow, ovalBackgroundColor);
}
/**
@@ -467,12 +467,12 @@
*/
public static KeyButtonDrawable create(Context context, @ColorInt int lightColor,
@ColorInt int darkColor, @DrawableRes int iconResId, boolean hasShadow,
- boolean hasOvalBg) {
+ Color ovalBackgroundColor) {
final Resources res = context.getResources();
boolean isRtl = res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
Drawable d = context.getDrawable(iconResId);
final KeyButtonDrawable drawable = new KeyButtonDrawable(d, lightColor, darkColor,
- isRtl && d.isAutoMirrored(), hasOvalBg);
+ isRtl && d.isAutoMirrored(), ovalBackgroundColor);
if (hasShadow) {
int offsetX = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_x);
int offsetY = res.getDimensionPixelSize(R.dimen.nav_key_button_shadow_offset_y);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index c9579fd..64b2842 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -79,6 +79,7 @@
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private final InputManager mInputManager;
private final Paint mOvalBgPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
+ private float mDarkIntensity;
private boolean mHasOvalBg = false;
private final Runnable mCheckLongPress = new Runnable() {
@@ -304,6 +305,23 @@
return true;
}
+ @Override
+ public void setImageDrawable(Drawable drawable) {
+ super.setImageDrawable(drawable);
+
+ if (drawable == null) {
+ return;
+ }
+ KeyButtonDrawable keyButtonDrawable = (KeyButtonDrawable) drawable;
+ keyButtonDrawable.setDarkIntensity(mDarkIntensity);
+ mHasOvalBg = keyButtonDrawable.hasOvalBg();
+ if (mHasOvalBg) {
+ mOvalBgPaint.setColor(keyButtonDrawable.getDrawableBackgroundColor());
+ }
+ mRipple.setType(keyButtonDrawable.hasOvalBg() ? KeyButtonRipple.Type.OVAL
+ : KeyButtonRipple.Type.ROUNDED_RECT);
+ }
+
public void playSoundEffect(int soundConstant) {
if (!mPlaySounds) return;
mAudioManager.playSoundEffect(soundConstant, ActivityManager.getCurrentUser());
@@ -360,17 +378,11 @@
@Override
public void setDarkIntensity(float darkIntensity) {
+ mDarkIntensity = darkIntensity;
+
Drawable drawable = getDrawable();
if (drawable != null) {
- KeyButtonDrawable keyButtonDrawable = (KeyButtonDrawable) drawable;
- keyButtonDrawable.setDarkIntensity(darkIntensity);
- mHasOvalBg = keyButtonDrawable.hasOvalBg();
- if (mHasOvalBg) {
- mOvalBgPaint.setColor(keyButtonDrawable.getDarkColor());
- }
- mRipple.setType(keyButtonDrawable.hasOvalBg() ? KeyButtonRipple.Type.OVAL
- : KeyButtonRipple.Type.ROUNDED_RECT);
-
+ ((KeyButtonDrawable) drawable).setDarkIntensity(darkIntensity);
// Since we reuse the same drawable for multiple views, we need to invalidate the view
// manually.
invalidate();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
index cb70a1f..be69f5f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarContextTest.java
@@ -180,9 +180,9 @@
final Drawable d = mock(Drawable.class);
final ContextualButton button = spy(mBtn0);
final KeyButtonDrawable kbd1 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor,
- false /* horizontalFlip */, false /* hasOvalBg */));
+ false /* horizontalFlip */, null /* ovalBackgroundColor */));
final KeyButtonDrawable kbd2 = spy(new KeyButtonDrawable(d, unusedColor, unusedColor,
- false /* horizontalFlip */, false /* hasOvalBg */));
+ false /* horizontalFlip */, null /* ovalBackgroundColor */));
kbd1.setDarkIntensity(TEST_DARK_INTENSITY);
kbd2.setDarkIntensity(0f);
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 5027a12..1cca0b9 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -6901,8 +6901,10 @@
final int userId = UserHandle.getCallingUserId();
- final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
- ipMemoryStore.factoryReset();
+ Binder.withCleanCallingIdentity(() -> {
+ final IpMemoryStore ipMemoryStore = IpMemoryStore.getMemoryStore(mContext);
+ ipMemoryStore.factoryReset();
+ });
// Turn airplane mode off
setAirplaneMode(false);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f14a3fd..627ca91 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7299,6 +7299,13 @@
if (wasInLaunchingProviders) {
mHandler.removeMessages(CONTENT_PROVIDER_PUBLISH_TIMEOUT_MSG, r);
}
+ // Make sure the package is associated with the process.
+ // XXX We shouldn't need to do this, since we have added the package
+ // when we generated the providers in generateApplicationProvidersLocked().
+ // But for some reason in some cases we get here with the package no longer
+ // added... for now just patch it in to make things happy.
+ r.addPackage(dst.info.applicationInfo.packageName,
+ dst.info.applicationInfo.longVersionCode, mProcessStats);
synchronized (dst) {
dst.provider = src.provider;
dst.setProcess(r);
diff --git a/services/core/java/com/android/server/biometrics/ClientMonitor.java b/services/core/java/com/android/server/biometrics/ClientMonitor.java
index 421b3f5..942e050 100644
--- a/services/core/java/com/android/server/biometrics/ClientMonitor.java
+++ b/services/core/java/com/android/server/biometrics/ClientMonitor.java
@@ -42,12 +42,7 @@
private static final AudioAttributes FINGERPRINT_SONFICATION_ATTRIBUTES =
new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- // Temporary fix for b/123870990. No time in this release to
- // introduce a new vibration type, but we need to distinguish these vibrations
- // from other haptic feedback vibrations. Fortunately, Alarm vibrations have
- // exactly the same behavior as we need
- // TODO: refactor within the scope of b/132170758
- .setUsage(AudioAttributes.USAGE_ALARM)
+ .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
.build();
private final Context mContext;
diff --git a/services/core/java/com/android/server/gpu/GpuService.java b/services/core/java/com/android/server/gpu/GpuService.java
index d439653..955f177 100644
--- a/services/core/java/com/android/server/gpu/GpuService.java
+++ b/services/core/java/com/android/server/gpu/GpuService.java
@@ -64,7 +64,6 @@
private static final String PROPERTY_GFX_DRIVER = "ro.gfx.driver.0";
private static final String GAME_DRIVER_WHITELIST_FILENAME = "whitelist.txt";
- private static final String GAME_DRIVER_SPHAL_LIBRARIES_FILENAME = "sphal_libraries.txt";
private static final int BASE64_FLAGS = Base64.NO_PADDING | Base64.NO_WRAP;
private final Context mContext;
@@ -230,9 +229,6 @@
// Reset the whitelist.
Settings.Global.putString(mContentResolver,
Settings.Global.GAME_DRIVER_WHITELIST, "");
- // Reset the sphal libraries
- Settings.Global.putString(mContentResolver,
- Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, "");
mGameDriverVersionCode = driverInfo.longVersionCode;
try {
@@ -241,10 +237,6 @@
assetToSettingsGlobal(mContext, driverContext, GAME_DRIVER_WHITELIST_FILENAME,
Settings.Global.GAME_DRIVER_WHITELIST, ",");
-
- assetToSettingsGlobal(mContext, driverContext, GAME_DRIVER_SPHAL_LIBRARIES_FILENAME,
- Settings.Global.GAME_DRIVER_SPHAL_LIBRARIES, ":");
-
} catch (PackageManager.NameNotFoundException e) {
if (DEBUG) {
Slog.w(TAG, "driver package '" + mDriverPackageName + "' not installed");
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 4a9a3f7..9189279 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1322,7 +1322,9 @@
if (prevDc == null || prevDc == mDisplayContent) {
return;
}
- if (prevDc.mChangingApps.contains(this)) {
+
+ prevDc.mOpeningApps.remove(this);
+ if (prevDc.mChangingApps.remove(this)) {
// This gets called *after* the AppWindowToken has been reparented to the new display.
// That reparenting resulted in this window changing modes (eg. FREEFORM -> FULLSCREEN),
// so this token is now "frozen" while waiting for the animation to start on prevDc
@@ -1331,6 +1333,8 @@
// so we need to cancel the change transition here.
clearChangeLeash(getPendingTransaction(), true /* cancel */);
}
+ prevDc.mClosingApps.remove(this);
+
if (prevDc.mFocusedApp == this) {
prevDc.setFocusedApp(null);
final TaskStack stack = dc.getTopStack();
@@ -3216,16 +3220,6 @@
true /* topToBottom */);
}
- void removeFromPendingTransition() {
- if (isWaitingForTransitionStart() && mDisplayContent != null) {
- mDisplayContent.mOpeningApps.remove(this);
- if (mDisplayContent.mChangingApps.remove(this)) {
- clearChangeLeash(getPendingTransaction(), true /* cancel */);
- }
- mDisplayContent.mClosingApps.remove(this);
- }
- }
-
private void updateColorTransform() {
if (mSurfaceControl != null && mLastAppSaturationInfo != null) {
getPendingTransaction().setColorTransform(mSurfaceControl,
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index c3a769b..80848a8f 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -2377,9 +2377,6 @@
+ " to its current displayId=" + mDisplayId);
}
- // Clean up all pending transitions when stack reparent to another display.
- stack.forAllAppWindows(AppWindowToken::removeFromPendingTransition);
-
prevDc.mTaskStackContainers.removeChild(stack);
mTaskStackContainers.addStackToDisplay(stack, onTop);
}
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index c9c0edc..91f875e 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -408,9 +408,10 @@
for (int i=0; i<descriptor->field_count(); i++) {
const FieldDescriptor* field = descriptor->field(i);
- if (field->type() != FieldDescriptor::TYPE_MESSAGE
- && field->type() != FieldDescriptor::TYPE_STRING) {
- continue;
+ if (field->type() != FieldDescriptor::TYPE_MESSAGE &&
+ field->type() != FieldDescriptor::TYPE_STRING &&
+ field->type() != FieldDescriptor::TYPE_BYTES) {
+ continue;
}
const SectionFlags s = getSectionFlags(field);