Merge "WM: Mock or stub SurfaceControl and Surface calls in wm unit tests"
diff --git a/api/current.txt b/api/current.txt
index f31dfff..4ef5243 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5473,6 +5473,7 @@
public static final class Notification.BubbleMetadata implements android.os.Parcelable {
method public int describeContents();
method public boolean getAutoExpandBubble();
+ method public android.app.PendingIntent getDeleteIntent();
method public int getDesiredHeight();
method public android.graphics.drawable.Icon getIcon();
method public android.app.PendingIntent getIntent();
@@ -5486,6 +5487,7 @@
ctor public Notification.BubbleMetadata.Builder();
method public android.app.Notification.BubbleMetadata build();
method public android.app.Notification.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+ method public android.app.Notification.BubbleMetadata.Builder setDeleteIntent(android.app.PendingIntent);
method public android.app.Notification.BubbleMetadata.Builder setDesiredHeight(int);
method public android.app.Notification.BubbleMetadata.Builder setIcon(android.graphics.drawable.Icon);
method public android.app.Notification.BubbleMetadata.Builder setIntent(android.app.PendingIntent);
@@ -24012,8 +24014,8 @@
method public int getMaxImages();
method public android.view.Surface getSurface();
method public int getWidth();
- method public static android.media.ImageReader newInstance(int, int, int, int);
- method public static android.media.ImageReader newInstance(int, int, int, int, long);
+ method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int);
+ method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
method public void setOnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener, android.os.Handler);
}
@@ -24026,8 +24028,8 @@
method public android.media.Image dequeueInputImage();
method public int getFormat();
method public int getMaxImages();
- method public static android.media.ImageWriter newInstance(android.view.Surface, int);
- method public static android.media.ImageWriter newInstance(android.view.Surface, int, int);
+ method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int);
+ method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int, int);
method public void queueInputImage(android.media.Image);
method public void setOnImageReleasedListener(android.media.ImageWriter.OnImageReleasedListener, android.os.Handler);
}
@@ -45190,6 +45192,7 @@
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean isDataEnabled();
method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled();
method public boolean isHearingAidCompatibilitySupported();
+ method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isMultisimSupported();
method public boolean isNetworkRoaming();
method public boolean isRttSupported();
method public boolean isSmsCapable();
@@ -47475,6 +47478,7 @@
method public int getVerticalAlignment();
field public static final int ALIGN_BASELINE = 1; // 0x1
field public static final int ALIGN_BOTTOM = 0; // 0x0
+ field public static final int ALIGN_CENTER = 2; // 0x2
field protected final int mVerticalAlignment;
}
diff --git a/api/system-current.txt b/api/system-current.txt
index c831522..e4b2014 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5537,6 +5537,7 @@
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.os.PersistableBundle getSeedAccountOptions();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public String getSeedAccountType();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean);
+ method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.graphics.Bitmap getUserIcon();
method @Deprecated @android.os.UserManager.UserRestrictionSource @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public int getUserRestrictionSource(String, android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public java.util.List<android.os.UserManager.EnforcingUser> getUserRestrictionSources(String, android.os.UserHandle);
method public boolean hasRestrictedProfiles();
@@ -5547,6 +5548,8 @@
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isPrimaryUser();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isRestrictedProfile();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean removeUser(android.os.UserHandle);
+ method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserIcon(android.graphics.Bitmap);
+ method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserName(String);
field public static final String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
field @Deprecated public static final String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
field public static final String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
@@ -7912,7 +7915,6 @@
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCurrentPotentialEmergencyNumber(@NonNull String);
method public boolean isDataConnectivityPossible();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle();
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isMultisimCarrierRestricted();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isRebootRequiredForModemConfigChange();
diff --git a/api/test-current.txt b/api/test-current.txt
index 2a45cd3..1981d68 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -483,6 +483,17 @@
package android.content {
+ public final class AutofillOptions implements android.os.Parcelable {
+ ctor public AutofillOptions(int, boolean);
+ method public int describeContents();
+ method public static android.content.AutofillOptions forWhitelistingItself();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.content.AutofillOptions> CREATOR;
+ field public boolean augmentedEnabled;
+ field public final boolean compatModeEnabled;
+ field public final int loggingLevel;
+ }
+
public final class ContentCaptureOptions implements android.os.Parcelable {
ctor public ContentCaptureOptions(int, int, int, int, int, @Nullable android.util.ArraySet<android.content.ComponentName>);
method public int describeContents();
@@ -509,7 +520,7 @@
method public android.content.Context createPackageContextAsUser(String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
method public android.os.UserHandle getUser();
method public int getUserId();
- method public void setAutofillCompatibilityEnabled(boolean);
+ method public void setAutofillOptions(@Nullable android.content.AutofillOptions);
method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
}
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 62926cb..78e994f 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -5455,7 +5455,7 @@
HEADER_GO_TO_SETTINGS = 9;
PERMISSION_OPT_IN = 10;
PERMISSION_OPT_OUT = 11;
- PERMISSION_IGNORED = 12;
+ PERMISSION_DIALOG_SHOWN = 12;
SWIPE_LEFT = 13;
SWIPE_RIGHT = 14;
STACK_EXPANDED = 15;
diff --git a/cmds/statsd/src/guardrail/StatsdStats.cpp b/cmds/statsd/src/guardrail/StatsdStats.cpp
index d661ee8..71d39ff 100644
--- a/cmds/statsd/src/guardrail/StatsdStats.cpp
+++ b/cmds/statsd/src/guardrail/StatsdStats.cpp
@@ -493,6 +493,11 @@
getAtomMetricStats(metricId).invalidatedBucket++;
}
+void StatsdStats::noteBucketCount(int64_t metricId) {
+ lock_guard<std::mutex> lock(mLock);
+ getAtomMetricStats(metricId).bucketCount++;
+}
+
void StatsdStats::noteBucketBoundaryDelayNs(int64_t metricId, int64_t timeDelayNs) {
lock_guard<std::mutex> lock(mLock);
AtomMetricStats& pullStats = getAtomMetricStats(metricId);
diff --git a/cmds/statsd/src/guardrail/StatsdStats.h b/cmds/statsd/src/guardrail/StatsdStats.h
index e039be2..7c2d846 100644
--- a/cmds/statsd/src/guardrail/StatsdStats.h
+++ b/cmds/statsd/src/guardrail/StatsdStats.h
@@ -403,6 +403,11 @@
void noteInvalidatedBucket(int64_t metricId);
/**
+ * Tracks the total number of buckets (include skipped/invalid buckets).
+ */
+ void noteBucketCount(int64_t metricId);
+
+ /**
* For pulls at bucket boundaries, it represents the misalignment between the real timestamp and
* the end of the bucket.
*/
@@ -464,6 +469,7 @@
int64_t minBucketBoundaryDelayNs = 0;
int64_t maxBucketBoundaryDelayNs = 0;
long bucketUnknownCondition = 0;
+ long bucketCount = 0;
} AtomMetricStats;
private:
diff --git a/cmds/statsd/src/metrics/CountMetricProducer.cpp b/cmds/statsd/src/metrics/CountMetricProducer.cpp
index 96d1447..254d7d5 100644
--- a/cmds/statsd/src/metrics/CountMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/CountMetricProducer.cpp
@@ -371,6 +371,7 @@
}
}
+ StatsdStats::getInstance().noteBucketCount(mMetricId);
// Only resets the counters, but doesn't setup the times nor numbers.
// (Do not clear since the old one is still referenced in mAnomalyTrackers).
mCurrentSlicedCounter = std::make_shared<DimToValMap>();
diff --git a/cmds/statsd/src/metrics/DurationMetricProducer.cpp b/cmds/statsd/src/metrics/DurationMetricProducer.cpp
index 5e4594b..7dc4e2d 100644
--- a/cmds/statsd/src/metrics/DurationMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/DurationMetricProducer.cpp
@@ -601,6 +601,7 @@
whatIt++;
}
}
+ StatsdStats::getInstance().noteBucketCount(mMetricId);
}
void DurationMetricProducer::dumpStatesLocked(FILE* out, bool verbose) const {
diff --git a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
index 7b001b3..2b6cac8 100644
--- a/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/GaugeMetricProducer.cpp
@@ -576,6 +576,7 @@
}
}
+ StatsdStats::getInstance().noteBucketCount(mMetricId);
mCurrentSlicedBucket = std::make_shared<DimToGaugeAtomsMap>();
}
diff --git a/cmds/statsd/src/metrics/ValueMetricProducer.cpp b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
index e94b75c..e7f7af2 100644
--- a/cmds/statsd/src/metrics/ValueMetricProducer.cpp
+++ b/cmds/statsd/src/metrics/ValueMetricProducer.cpp
@@ -769,6 +769,7 @@
if (!mCurrentBucketIsInvalid) {
appendToFullBucket(eventTimeNs, fullBucketEndTimeNs);
}
+ StatsdStats::getInstance().noteBucketCount(mMetricId);
initCurrentSlicedBucket();
mCurrentBucketIsInvalid = false;
mCurrentBucketStartTimeNs = nextBucketStartTimeNs;
diff --git a/cmds/statsd/src/stats_log.proto b/cmds/statsd/src/stats_log.proto
index 623d8bc..166e087 100644
--- a/cmds/statsd/src/stats_log.proto
+++ b/cmds/statsd/src/stats_log.proto
@@ -426,6 +426,7 @@
optional int64 min_bucket_boundary_delay_ns = 9;
optional int64 max_bucket_boundary_delay_ns = 10;
optional int64 bucket_unknown_condition = 11;
+ optional int64 bucket_count = 12;
}
repeated AtomMetricStats atom_metric_stats = 17;
diff --git a/cmds/statsd/src/stats_log_util.cpp b/cmds/statsd/src/stats_log_util.cpp
index ca645e1..31f160d 100644
--- a/cmds/statsd/src/stats_log_util.cpp
+++ b/cmds/statsd/src/stats_log_util.cpp
@@ -85,6 +85,7 @@
const int FIELD_ID_MIN_BUCKET_BOUNDARY_DELAY_NS = 9;
const int FIELD_ID_MAX_BUCKET_BOUNDARY_DELAY_NS = 10;
const int FIELD_ID_BUCKET_UNKNOWN_CONDITION = 11;
+const int FIELD_ID_BUCKET_COUNT = 12;
namespace {
@@ -515,6 +516,8 @@
(long long)pair.second.maxBucketBoundaryDelayNs);
protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_BUCKET_UNKNOWN_CONDITION,
(long long)pair.second.bucketUnknownCondition);
+ protoOutput->write(FIELD_TYPE_INT64 | FIELD_ID_BUCKET_COUNT,
+ (long long)pair.second.bucketCount);
protoOutput->end(token);
}
diff --git a/cmds/svc/src/com/android/commands/svc/Svc.java b/cmds/svc/src/com/android/commands/svc/Svc.java
index 62225df..68fb8e6 100644
--- a/cmds/svc/src/com/android/commands/svc/Svc.java
+++ b/cmds/svc/src/com/android/commands/svc/Svc.java
@@ -98,5 +98,6 @@
new UsbCommand(),
new NfcCommand(),
new BluetoothCommand(),
+ new SystemServerCommand(),
};
}
diff --git a/cmds/svc/src/com/android/commands/svc/SystemServerCommand.java b/cmds/svc/src/com/android/commands/svc/SystemServerCommand.java
new file mode 100644
index 0000000..b9104d1
--- /dev/null
+++ b/cmds/svc/src/com/android/commands/svc/SystemServerCommand.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.commands.svc;
+
+import android.app.ActivityManager;
+import android.os.ParcelFileDescriptor;
+
+import java.io.FileInputStream;
+
+public class SystemServerCommand extends Svc.Command {
+ public SystemServerCommand() {
+ super("system-server");
+ }
+
+ @Override
+ public String shortHelp() {
+ return "System server process related command";
+ }
+
+ @Override
+ public String longHelp() {
+ return shortHelp() + "\n"
+ + "\n"
+ + "usage: system-server wait-for-crash\n"
+ + " Wait until the system server process crashes.\n\n";
+ }
+
+ private void waitForCrash() throws Exception {
+ ParcelFileDescriptor fd = ActivityManager.getService().getLifeMonitor();
+ if (fd == null) {
+ System.err.println("Unable to get life monitor.");
+ return;
+ }
+ System.out.println("Waiting for the system server process to die...");
+ new FileInputStream(fd.getFileDescriptor()).read();
+ }
+
+ @Override
+ public void run(String[] args) {
+ try {
+ if (args.length > 1) {
+ switch (args[1]) {
+ case "wait-for-crash":
+ waitForCrash();
+ return;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ System.err.println(longHelp());
+ }
+}
diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt
index a836e8e..7f7972a 100644
--- a/config/hiddenapi-greylist.txt
+++ b/config/hiddenapi-greylist.txt
@@ -3107,10 +3107,6 @@
Lcom/android/internal/telephony/ISms$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ISms;
Lcom/android/internal/telephony/ISub$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/telephony/ISub$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ISub;
-Lcom/android/internal/telephony/ISub;->getActiveSubIdList()[I
-Lcom/android/internal/telephony/ISub;->getDefaultDataSubId()I
-Lcom/android/internal/telephony/ISub;->getDefaultSubId()I
-Lcom/android/internal/telephony/ISub;->setDefaultDataSubId(I)V
Lcom/android/internal/telephony/ITelephony$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/telephony/ITelephony$Stub$Proxy;->getDeviceId(Ljava/lang/String;)Ljava/lang/String;
Lcom/android/internal/telephony/ITelephony$Stub$Proxy;->isRadioOn(Ljava/lang/String;)Z
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 89e848b..a63350c 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -7608,7 +7608,7 @@
mWindow.setColorMode(info.colorMode);
- setAutofillCompatibilityEnabled(application.isAutofillCompatibilityEnabled());
+ setAutofillOptions(application.getAutofillOptions());
setContentCaptureOptions(application.getContentCaptureOptions());
}
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 001cd69..92302c5 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -43,6 +43,7 @@
import android.app.servertransaction.PendingTransactionActions.StopInfo;
import android.app.servertransaction.TransactionExecutor;
import android.app.servertransaction.TransactionExecutorHelper;
+import android.content.AutofillOptions;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
import android.content.ComponentName;
@@ -745,7 +746,7 @@
/** Initial values for {@link Profiler}. */
ProfilerInfo initProfilerInfo;
- boolean autofillCompatibilityEnabled;
+ AutofillOptions autofillOptions;
/**
* Content capture options for the application - when null, it means ContentCapture is not
@@ -975,9 +976,8 @@
boolean enableBinderTracking, boolean trackAllocation,
boolean isRestrictedBackupMode, boolean persistent, Configuration config,
CompatibilityInfo compatInfo, Map services, Bundle coreSettings,
- String buildSerial, boolean autofillCompatibilityEnabled,
+ String buildSerial, AutofillOptions autofillOptions,
ContentCaptureOptions contentCaptureOptions) {
-
if (services != null) {
if (false) {
// Test code to make sure the app could see the passed-in services.
@@ -1023,7 +1023,7 @@
data.compatInfo = compatInfo;
data.initProfilerInfo = profilerInfo;
data.buildSerial = buildSerial;
- data.autofillCompatibilityEnabled = autofillCompatibilityEnabled;
+ data.autofillOptions = autofillOptions;
data.contentCaptureOptions = contentCaptureOptions;
sendMessage(H.BIND_APPLICATION, data);
}
@@ -6164,7 +6164,7 @@
app = data.info.makeApplication(data.restrictedBackupMode, null);
// Propagate autofill compat state
- app.setAutofillCompatibilityEnabled(data.autofillCompatibilityEnabled);
+ app.setAutofillOptions(data.autofillOptions);
// Propagate Content Capture options
app.setContentCaptureOptions(data.contentCaptureOptions);
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index 9306224..a4b763d 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -400,7 +400,7 @@
final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
mRootSurfaceControl = new SurfaceControl.Builder(surfaceSession)
- .setContainerLayer(true)
+ .setContainerLayer()
.setParent(mSurfaceView.getSurfaceControl())
.setName(DISPLAY_NAME)
.build();
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 3a1e80d..b792ad2 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -19,8 +19,8 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
+import android.content.AutofillOptions;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentCaptureOptions;
@@ -215,8 +215,8 @@
// The name of the split this Context is representing. May be null.
private @Nullable String mSplitName = null;
- private AutofillClient mAutofillClient = null;
- private boolean mIsAutofillCompatEnabled;
+ private @Nullable AutofillClient mAutofillClient = null;
+ private @Nullable AutofillOptions mAutofillOptions;
private ContentCaptureOptions mContentCaptureOptions = null;
@@ -2376,15 +2376,14 @@
/** @hide */
@Override
- public boolean isAutofillCompatibilityEnabled() {
- return mIsAutofillCompatEnabled;
+ public AutofillOptions getAutofillOptions() {
+ return mAutofillOptions;
}
/** @hide */
- @TestApi
@Override
- public void setAutofillCompatibilityEnabled(boolean autofillCompatEnabled) {
- mIsAutofillCompatEnabled = autofillCompatEnabled;
+ public void setAutofillOptions(AutofillOptions options) {
+ mAutofillOptions = options;
}
/** @hide */
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 3aa9fa7..dcef9d2 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -486,4 +486,7 @@
* started from the shell.
*/
void stopDelegateShellPermissionIdentity();
+
+ /** Returns a file descriptor that'll be closed when the system server process dies. */
+ ParcelFileDescriptor getLifeMonitor();
}
diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl
index b73092a..b8af898 100644
--- a/core/java/android/app/IApplicationThread.aidl
+++ b/core/java/android/app/IApplicationThread.aidl
@@ -21,6 +21,7 @@
import android.app.ProfilerInfo;
import android.app.ResultInfo;
import android.app.servertransaction.ClientTransaction;
+import android.content.AutofillOptions;
import android.content.ComponentName;
import android.content.ContentCaptureOptions;
import android.content.IIntentReceiver;
@@ -69,7 +70,7 @@
int debugMode, boolean enableBinderTracking, boolean trackAllocation,
boolean restrictedBackupMode, boolean persistent, in Configuration config,
in CompatibilityInfo compatInfo, in Map services,
- in Bundle coreSettings, in String buildSerial, boolean isAutofillCompatEnabled,
+ in Bundle coreSettings, in String buildSerial, in AutofillOptions autofillOptions,
in ContentCaptureOptions contentCaptureOptions);
void runIsolatedEntryPoint(in String entryPoint, in String[] entryPointArgs);
void scheduleExit();
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index dc4f343..0166f52 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -8408,6 +8408,7 @@
public static final class BubbleMetadata implements Parcelable {
private PendingIntent mPendingIntent;
+ private PendingIntent mDeleteIntent;
private CharSequence mTitle;
private Icon mIcon;
private int mDesiredHeight;
@@ -8436,11 +8437,13 @@
*/
private static final int FLAG_SUPPRESS_INITIAL_NOTIFICATION = 0x00000002;
- private BubbleMetadata(PendingIntent intent, CharSequence title, Icon icon, int height) {
- mPendingIntent = intent;
+ private BubbleMetadata(PendingIntent expandIntent, PendingIntent deleteIntent,
+ CharSequence title, Icon icon, int height) {
+ mPendingIntent = expandIntent;
mTitle = title;
mIcon = icon;
mDesiredHeight = height;
+ mDeleteIntent = deleteIntent;
}
private BubbleMetadata(Parcel in) {
@@ -8449,6 +8452,9 @@
mIcon = Icon.CREATOR.createFromParcel(in);
mDesiredHeight = in.readInt();
mFlags = in.readInt();
+ if (in.readInt() != 0) {
+ mDeleteIntent = PendingIntent.CREATOR.createFromParcel(in);
+ }
}
/**
@@ -8459,6 +8465,13 @@
}
/**
+ * @return the pending intent to send when the bubble is dismissed by a user, if one exists.
+ */
+ public PendingIntent getDeleteIntent() {
+ return mDeleteIntent;
+ }
+
+ /**
* @return the title that will appear along with the app content defined by
* {@link #getIntent()} for this bubble.
*/
@@ -8525,6 +8538,10 @@
mIcon.writeToParcel(out, 0);
out.writeInt(mDesiredHeight);
out.writeInt(mFlags);
+ out.writeInt(mDeleteIntent != null ? 1 : 0);
+ if (mDeleteIntent != null) {
+ mDeleteIntent.writeToParcel(out, 0);
+ }
}
private void setFlags(int flags) {
@@ -8541,6 +8558,7 @@
private Icon mIcon;
private int mDesiredHeight;
private int mFlags;
+ private PendingIntent mDeleteIntent;
/**
* Constructs a new builder object.
@@ -8633,6 +8651,14 @@
}
/**
+ * Sets an optional intent to send when this bubble is explicitly removed by the user.
+ */
+ public BubbleMetadata.Builder setDeleteIntent(PendingIntent deleteIntent) {
+ mDeleteIntent = deleteIntent;
+ return this;
+ }
+
+ /**
* Creates the {@link BubbleMetadata} defined by this builder.
* <p>Will throw {@link IllegalStateException} if required fields have not been set
* on this builder.</p>
@@ -8647,8 +8673,8 @@
if (mIcon == null) {
throw new IllegalStateException("Must supply an icon for the bubble");
}
- BubbleMetadata data = new BubbleMetadata(mPendingIntent, mTitle, mIcon,
- mDesiredHeight);
+ BubbleMetadata data = new BubbleMetadata(mPendingIntent, mDeleteIntent, mTitle,
+ mIcon, mDesiredHeight);
data.setFlags(mFlags);
return data;
}
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java
index 868fbfe..bcc4974 100644
--- a/core/java/android/app/backup/BackupManager.java
+++ b/core/java/android/app/backup/BackupManager.java
@@ -762,6 +762,7 @@
*/
@Nullable
public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) {
+ checkServiceBinder();
if (sService != null) {
try {
return sService.getUserForAncestralSerialNumber(ancestralSerialNumber);
@@ -782,6 +783,7 @@
@SystemApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public void setAncestralSerialNumber(long ancestralSerialNumber) {
+ checkServiceBinder();
if (sService != null) {
try {
sService.setAncestralSerialNumber(ancestralSerialNumber);
@@ -802,6 +804,7 @@
@TestApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public Intent getConfigurationIntent(String transportName) {
+ checkServiceBinder();
if (sService != null) {
try {
return sService.getConfigurationIntentForUser(mContext.getUserId(), transportName);
@@ -823,6 +826,7 @@
@TestApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public String getDestinationString(String transportName) {
+ checkServiceBinder();
if (sService != null) {
try {
return sService.getDestinationStringForUser(mContext.getUserId(), transportName);
@@ -844,6 +848,7 @@
@TestApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public Intent getDataManagementIntent(String transportName) {
+ checkServiceBinder();
if (sService != null) {
try {
return sService.getDataManagementIntentForUser(mContext.getUserId(), transportName);
@@ -867,6 +872,7 @@
@TestApi
@RequiresPermission(android.Manifest.permission.BACKUP)
public String getDataManagementLabel(String transportName) {
+ checkServiceBinder();
if (sService != null) {
try {
return sService.getDataManagementLabelForUser(mContext.getUserId(), transportName);
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java
index 3e9dd28..85f0e23 100644
--- a/core/java/android/appwidget/AppWidgetHostView.java
+++ b/core/java/android/appwidget/AppWidgetHostView.java
@@ -30,7 +30,6 @@
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Rect;
-import android.os.Build;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.Parcelable;
@@ -178,40 +177,29 @@
*/
public static Rect getDefaultPaddingForWidget(Context context, ComponentName component,
Rect padding) {
- ApplicationInfo appInfo = null;
- try {
- appInfo = context.getPackageManager().getApplicationInfo(component.getPackageName(), 0);
- } catch (NameNotFoundException e) {
- // if we can't find the package, ignore
- }
- return getDefaultPaddingForWidget(context, appInfo, padding);
+ return getDefaultPaddingForWidget(context, padding);
}
- @UnsupportedAppUsage
- private static Rect getDefaultPaddingForWidget(Context context, ApplicationInfo appInfo,
- Rect padding) {
+ private static Rect getDefaultPaddingForWidget(Context context, Rect padding) {
if (padding == null) {
padding = new Rect(0, 0, 0, 0);
} else {
padding.set(0, 0, 0, 0);
}
- if (appInfo != null && appInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- Resources r = context.getResources();
- padding.left = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_left);
- padding.right = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_right);
- padding.top = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_top);
- padding.bottom = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_bottom);
- }
+ Resources r = context.getResources();
+ padding.left = r.getDimensionPixelSize(
+ com.android.internal.R.dimen.default_app_widget_padding_left);
+ padding.right = r.getDimensionPixelSize(
+ com.android.internal.R.dimen.default_app_widget_padding_right);
+ padding.top = r.getDimensionPixelSize(
+ com.android.internal.R.dimen.default_app_widget_padding_top);
+ padding.bottom = r.getDimensionPixelSize(
+ com.android.internal.R.dimen.default_app_widget_padding_bottom);
return padding;
}
private Rect getDefaultPadding() {
- return getDefaultPaddingForWidget(mContext,
- mInfo == null ? null : mInfo.providerInfo.applicationInfo, null);
+ return getDefaultPaddingForWidget(mContext, null);
}
public int getAppWidgetId() {
diff --git a/core/java/android/content/AutofillOptions.aidl b/core/java/android/content/AutofillOptions.aidl
new file mode 100644
index 0000000..7e4fed2
--- /dev/null
+++ b/core/java/android/content/AutofillOptions.aidl
@@ -0,0 +1,19 @@
+/*
+** Copyright 2019, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+package android.content;
+
+parcelable AutofillOptions;
diff --git a/core/java/android/content/AutofillOptions.java b/core/java/android/content/AutofillOptions.java
new file mode 100644
index 0000000..fd7e52a
--- /dev/null
+++ b/core/java/android/content/AutofillOptions.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2018 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 android.content;
+
+import android.annotation.NonNull;
+import android.annotation.TestApi;
+import android.app.ActivityThread;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+import android.view.autofill.AutofillManager;
+
+import java.io.PrintWriter;
+
+/**
+ * Autofill options for a given package.
+ *
+ * <p>This object is created by the Autofill System Service and passed back to the app when the
+ * application is created.
+ *
+ * @hide
+ */
+@TestApi
+public final class AutofillOptions implements Parcelable {
+
+ private static final String TAG = AutofillOptions.class.getSimpleName();
+
+ /**
+ * Logging level for {@code logcat} statements.
+ */
+ public final int loggingLevel;
+
+ /**
+ * Whether compatibility mode is enabled for the package.
+ */
+ public final boolean compatModeEnabled;
+
+ /**
+ * Whether package is whitelisted for augmented autofill.
+ */
+ public boolean augmentedEnabled;
+ // TODO(b/123100824): add (optional) list of activities
+
+ public AutofillOptions(int loggingLevel, boolean compatModeEnabled) {
+ this.loggingLevel = loggingLevel;
+ this.compatModeEnabled = compatModeEnabled;
+ }
+
+ /**
+ * @hide
+ */
+ @TestApi
+ public static AutofillOptions forWhitelistingItself() {
+ final ActivityThread at = ActivityThread.currentActivityThread();
+ if (at == null) {
+ throw new IllegalStateException("No ActivityThread");
+ }
+
+ final String packageName = at.getApplication().getPackageName();
+
+ if (!"android.autofillservice.cts".equals(packageName)) {
+ Log.e(TAG, "forWhitelistingItself(): called by " + packageName);
+ throw new SecurityException("Thou shall not pass!");
+ }
+
+ final AutofillOptions options = new AutofillOptions(
+ AutofillManager.FLAG_ADD_CLIENT_VERBOSE, /* compatModeAllowed= */ true);
+ options.augmentedEnabled = true;
+ // Always log, as it's used by test only
+ Log.i(TAG, "forWhitelistingItself(" + packageName + "): " + options);
+
+ return options;
+ }
+
+ @Override
+ public String toString() {
+ return "AutofillOptions [loggingLevel=" + loggingLevel + ", compatMode="
+ + compatModeEnabled + ", augmentedEnabled=" + augmentedEnabled + "]";
+ }
+
+ /** @hide */
+ public void dumpShort(@NonNull PrintWriter pw) {
+ pw.print("logLvl="); pw.print(loggingLevel);
+ pw.print(", compatMode="); pw.print(compatModeEnabled);
+ pw.print(", augmented="); pw.print(augmentedEnabled);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt(loggingLevel);
+ parcel.writeBoolean(compatModeEnabled);
+ parcel.writeBoolean(augmentedEnabled);
+ }
+
+ public static final Parcelable.Creator<AutofillOptions> CREATOR =
+ new Parcelable.Creator<AutofillOptions>() {
+
+ @Override
+ public AutofillOptions createFromParcel(Parcel parcel) {
+ final int loggingLevel = parcel.readInt();
+ final boolean compatMode = parcel.readBoolean();
+ final AutofillOptions options = new AutofillOptions(loggingLevel, compatMode);
+ options.augmentedEnabled = parcel.readBoolean();
+ return options;
+ }
+
+ @Override
+ public AutofillOptions[] newArray(int size) {
+ return new AutofillOptions[size];
+ }
+ };
+}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index fdb0041..1f3a000 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -5340,16 +5340,24 @@
/**
* @hide
*/
- public boolean isAutofillCompatibilityEnabled() {
- return false;
+ public final boolean isAutofillCompatibilityEnabled() {
+ final AutofillOptions options = getAutofillOptions();
+ return options != null && options.compatModeEnabled;
+ }
+
+ /**
+ * @hide
+ */
+ @Nullable
+ public AutofillOptions getAutofillOptions() {
+ return null;
}
/**
* @hide
*/
@TestApi
- public void setAutofillCompatibilityEnabled(
- @SuppressWarnings("unused") boolean autofillCompatEnabled) {
+ public void setAutofillOptions(@SuppressWarnings("unused") @Nullable AutofillOptions options) {
}
/**
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 68b4320..fac3266 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -1031,22 +1031,17 @@
mBase.setAutofillClient(client);
}
- /**
- * @hide
- */
+ /** @hide */
@Override
- public boolean isAutofillCompatibilityEnabled() {
- return mBase != null && mBase.isAutofillCompatibilityEnabled();
+ public AutofillOptions getAutofillOptions() {
+ return mBase == null ? null : mBase.getAutofillOptions();
}
- /**
- * @hide
- */
- @TestApi
+ /** @hide */
@Override
- public void setAutofillCompatibilityEnabled(boolean autofillCompatEnabled) {
+ public void setAutofillOptions(AutofillOptions options) {
if (mBase != null) {
- mBase.setAutofillCompatibilityEnabled(autofillCompatEnabled);
+ mBase.setAutofillOptions(options);
}
}
diff --git a/core/java/android/hardware/display/Curve.java b/core/java/android/hardware/display/Curve.java
index ac28fdd..41f66f5 100644
--- a/core/java/android/hardware/display/Curve.java
+++ b/core/java/android/hardware/display/Curve.java
@@ -59,4 +59,18 @@
public int describeContents() {
return 0;
}
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("[");
+ final int size = mX.length;
+ for (int i = 0; i < size; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
+ sb.append("(").append(mX[i]).append(", ").append(mY[i]).append(")");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
}
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index e2b5730..0673755 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2697,6 +2697,19 @@
}
/**
+ * Updates the calling user's name.
+ * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ *
+ * @param name the new name for the user
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
+ public void setUserName(String name) {
+ setUserName(getUserHandle(), name);
+ }
+
+ /**
* Sets the user's photo.
* @param userHandle the user for whom to change the photo.
* @param icon the bitmap to set as the photo.
@@ -2711,6 +2724,19 @@
}
/**
+ * Sets the calling user's photo.
+ * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ *
+ * @param icon the bitmap to set as the photo.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
+ public void setUserIcon(Bitmap icon) {
+ setUserIcon(getUserHandle(), icon);
+ }
+
+ /**
* Returns a file descriptor for the user's photo. PNG data can be read from this file.
* @param userHandle the user whose photo we want to read.
* @return a {@link Bitmap} of the user's photo, or null if there's no photo.
@@ -2737,6 +2763,20 @@
}
/**
+ * Returns a Bitmap for the calling user's photo.
+ * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
+ *
+ * @return a {@link Bitmap} of the user's photo, or null if there's no photo.
+ * @see com.android.internal.util.UserIcons#getDefaultUserIcon for a default.
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
+ public Bitmap getUserIcon() {
+ return getUserIcon(getUserHandle());
+ }
+
+ /**
* Returns the maximum number of users that can be created on this device. A return value
* of 1 means that it is a single user device.
* @hide
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index a465b32..77e896e 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -14096,18 +14096,17 @@
public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
/**
+ * Whether to show the usb high temperature alarm notification.
+ * @hide
+ */
+ public static final String SHOW_USB_TEMPERATURE_ALARM = "show_usb_temperature_alarm";
+
+ /**
* Temperature at which the high temperature warning notification should be shown.
* @hide
*/
public static final String WARNING_TEMPERATURE = "warning_temperature";
-
- /**
- * USB Temperature at which the high temperature alarm notification should be shown.
- * @hide
- */
- public static final String USB_ALARM_TEMPERATURE = "usb_alarm_temperature";
-
/**
* Whether the diskstats logging task is enabled/disabled.
* @hide
diff --git a/core/java/android/text/style/DynamicDrawableSpan.java b/core/java/android/text/style/DynamicDrawableSpan.java
index 5754014..1a508a1 100644
--- a/core/java/android/text/style/DynamicDrawableSpan.java
+++ b/core/java/android/text/style/DynamicDrawableSpan.java
@@ -16,6 +16,9 @@
package android.text.style;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -25,6 +28,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
+import java.lang.annotation.Retention;
import java.lang.ref.WeakReference;
/**
@@ -80,10 +84,21 @@
/**
* A constant indicating that this span should be vertically centered between
* the top and the lowest descender.
- * @hide
*/
public static final int ALIGN_CENTER = 2;
+ /**
+ * Defines acceptable alignment types.
+ * @hide
+ */
+ @Retention(SOURCE)
+ @IntDef(prefix = { "ALIGN_" }, value = {
+ ALIGN_BOTTOM,
+ ALIGN_BASELINE,
+ ALIGN_CENTER
+ })
+ public @interface AlignmentType {}
+
protected final int mVerticalAlignment;
@UnsupportedAppUsage
@@ -100,17 +115,18 @@
/**
* Creates a {@link DynamicDrawableSpan} based on a vertical alignment.\
*
- * @param verticalAlignment one of {@link #ALIGN_BOTTOM} or {@link #ALIGN_BASELINE}
+ * @param verticalAlignment one of {@link #ALIGN_BOTTOM}, {@link #ALIGN_BASELINE} or
+ * {@link #ALIGN_CENTER}
*/
- protected DynamicDrawableSpan(int verticalAlignment) {
+ protected DynamicDrawableSpan(@AlignmentType int verticalAlignment) {
mVerticalAlignment = verticalAlignment;
}
/**
- * Returns the vertical alignment of this span, one of {@link #ALIGN_BOTTOM} or
- * {@link #ALIGN_BASELINE}.
+ * Returns the vertical alignment of this span, one of {@link #ALIGN_BOTTOM},
+ * {@link #ALIGN_BASELINE} or {@link #ALIGN_CENTER}.
*/
- public int getVerticalAlignment() {
+ public @AlignmentType int getVerticalAlignment() {
return mVerticalAlignment;
}
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 1212df0..aaf85af 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -189,6 +189,7 @@
IBinder toToken);
private static native boolean nativeGetProtectedContentSupport();
private static native void nativeSetMetadata(long transactionObj, int key, Parcel data);
+ private static native void nativeSyncInputWindows(long transactionObj);
private final CloseGuard mCloseGuard = CloseGuard.get();
private String mName;
@@ -489,7 +490,16 @@
}
mWidth = width;
mHeight = height;
- return this;
+ // set this as a buffer layer since we are specifying a buffer size.
+ return setFlags(FX_SURFACE_NORMAL, FX_SURFACE_MASK);
+ }
+
+ /**
+ * Set the initial size of the controlled surface's buffers in pixels.
+ */
+ private void unsetBufferSize() {
+ mWidth = 0;
+ mHeight = 0;
}
/**
@@ -607,16 +617,11 @@
* Color layers will not have an associated BufferQueue and will instead always render a
* solid color (that is, solid before plane alpha). Currently that color is black.
*
- * @param isColorLayer Whether to create a color layer.
* @hide
*/
- public Builder setColorLayer(boolean isColorLayer) {
- if (isColorLayer) {
- mFlags |= FX_SURFACE_DIM;
- } else {
- mFlags &= ~FX_SURFACE_DIM;
- }
- return this;
+ public Builder setColorLayer() {
+ unsetBufferSize();
+ return setFlags(FX_SURFACE_DIM, FX_SURFACE_MASK);
}
private boolean isColorLayerSet() {
@@ -629,16 +634,11 @@
* Container layers will not be rendered in any fashion and instead are used
* as a parent of renderable layers.
*
- * @param isContainerLayer Whether to create a container layer.
* @hide
*/
- public Builder setContainerLayer(boolean isContainerLayer) {
- if (isContainerLayer) {
- mFlags |= FX_SURFACE_CONTAINER;
- } else {
- mFlags &= ~FX_SURFACE_CONTAINER;
- }
- return this;
+ public Builder setContainerLayer() {
+ unsetBufferSize();
+ return setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK);
}
private boolean isContainerLayerSet() {
@@ -646,7 +646,7 @@
}
/**
- * Set 'Surface creation flags' such as {@link HIDDEN}, {@link SECURE}.
+ * Set 'Surface creation flags' such as {@link #HIDDEN}, {@link #SECURE}.
*
* TODO: Finish conversion to individual builder methods?
* @param flags The combined flags
@@ -656,6 +656,11 @@
mFlags = flags;
return this;
}
+
+ private Builder setFlags(int flags, int mask) {
+ mFlags = (mFlags & ~mask) | flags;
+ return this;
+ }
}
/**
@@ -2105,6 +2110,17 @@
}
/**
+ * Waits until any changes to input windows have been sent from SurfaceFlinger to
+ * InputFlinger before returning.
+ *
+ * @hide
+ */
+ public Transaction syncInputWindows() {
+ nativeSyncInputWindows(mNativeObject);
+ return this;
+ }
+
+ /**
* Specify how the buffer assosciated with this Surface is mapped in to the
* parent coordinate space. The source frame will be scaled to fit the destination
* frame, after being rotated according to the orientation parameter.
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 9f0800f..fe9aa23 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -33,7 +33,6 @@
import android.graphics.RenderNode;
import android.os.Build;
import android.os.Handler;
-import android.os.IBinder;
import android.os.Looper;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -588,7 +587,7 @@
mBackgroundControl = new SurfaceControl.Builder(mSurfaceSession)
.setName("Background for -" + name)
.setOpaque(true)
- .setColorLayer(true)
+ .setColorLayer()
.setParent(mSurfaceControl)
.build();
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index ab4847d..89c6703 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -29,6 +29,7 @@
import android.Manifest;
import android.animation.LayoutTransition;
+import android.annotation.AnyThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
@@ -1041,10 +1042,22 @@
return mHeight;
}
+ /**
+ * Destroys hardware rendering resources for this ViewRootImpl
+ *
+ * May be called on any thread
+ */
+ @AnyThread
void destroyHardwareResources() {
- if (mAttachInfo.mThreadedRenderer != null) {
- mAttachInfo.mThreadedRenderer.destroyHardwareResources(mView);
- mAttachInfo.mThreadedRenderer.destroy();
+ final ThreadedRenderer renderer = mAttachInfo.mThreadedRenderer;
+ if (renderer != null) {
+ // This is called by WindowManagerGlobal which may or may not be on the right thread
+ if (Looper.myLooper() != mAttachInfo.mHandler.getLooper()) {
+ mAttachInfo.mHandler.postAtFrontOfQueue(this::destroyHardwareResources);
+ return;
+ }
+ renderer.destroyHardwareResources(mView);
+ renderer.destroy();
}
}
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index e9b1683..9dcbe05 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -28,6 +28,7 @@
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
+import android.content.AutofillOptions;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -482,6 +483,9 @@
@GuardedBy("mLock")
private CompatibilityBridge mCompatibilityBridge;
+ @Nullable
+ private final AutofillOptions mOptions;
+
/** @hide */
public interface AutofillClient {
/**
@@ -618,6 +622,12 @@
public AutofillManager(Context context, IAutoFillManager service) {
mContext = Preconditions.checkNotNull(context, "context cannot be null");
mService = service;
+ mOptions = context.getAutofillOptions();
+
+ if (mOptions != null) {
+ sDebug = (mOptions.loggingLevel & FLAG_ADD_CLIENT_DEBUG) != 0;
+ sVerbose = (mOptions.loggingLevel & FLAG_ADD_CLIENT_VERBOSE) != 0;
+ }
}
/**
@@ -2352,6 +2362,9 @@
pw.print(pfx); pw.print("entered ids: "); pw.println(mEnteredIds);
pw.print(pfx); pw.print("save trigger id: "); pw.println(mSaveTriggerId);
pw.print(pfx); pw.print("save on finish(): "); pw.println(mSaveOnFinish);
+ if (mOptions != null) {
+ pw.print(pfx); pw.print("options: "); mOptions.dumpShort(pw); pw.println();
+ }
pw.print(pfx); pw.print("compat mode enabled: ");
synchronized (mLock) {
if (mCompatibilityBridge != null) {
diff --git a/core/java/android/view/autofill/AutofillManagerInternal.java b/core/java/android/view/autofill/AutofillManagerInternal.java
index 155fe72..d5862bd 100644
--- a/core/java/android/view/autofill/AutofillManagerInternal.java
+++ b/core/java/android/view/autofill/AutofillManagerInternal.java
@@ -16,7 +16,9 @@
package android.view.autofill;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.UserIdInt;
+import android.content.AutofillOptions;
/**
* Autofill Manager local system service interface.
@@ -31,12 +33,13 @@
public abstract void onBackKeyPressed();
/**
- * Gets whether compatibility mode is enabled for a package
+ * Gets autofill options for a package
*
* @param packageName The package for which to query.
* @param versionCode The package version code.
* @param userId The user id for which to query.
*/
- public abstract boolean isCompatibilityModeRequested(@NonNull String packageName,
+ @Nullable
+ public abstract AutofillOptions getAutofillOptions(@NonNull String packageName,
long versionCode, @UserIdInt int userId);
}
diff --git a/core/java/com/android/internal/os/BinderCallsStats.java b/core/java/com/android/internal/os/BinderCallsStats.java
index 7f4d8a2..2c78be7 100644
--- a/core/java/com/android/internal/os/BinderCallsStats.java
+++ b/core/java/com/android/internal/os/BinderCallsStats.java
@@ -51,7 +51,7 @@
public class BinderCallsStats implements BinderInternal.Observer {
public static final boolean ENABLED_DEFAULT = true;
public static final boolean DETAILED_TRACKING_DEFAULT = true;
- public static final int PERIODIC_SAMPLING_INTERVAL_DEFAULT = 100;
+ public static final int PERIODIC_SAMPLING_INTERVAL_DEFAULT = 1000;
public static final boolean DEFAULT_TRACK_SCREEN_INTERACTIVE = false;
public static final boolean DEFAULT_TRACK_DIRECT_CALLING_UID = true;
public static final int MAX_BINDER_CALL_STATS_COUNT_DEFAULT = 5000;
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 6b8d8b1..003ee37 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -406,6 +406,11 @@
transaction->transferTouchFocus(fromToken, toToken);
}
+static void nativeSyncInputWindows(JNIEnv* env, jclass clazz, jlong transactionObj) {
+ auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
+ transaction->syncInputWindows();
+}
+
static void nativeSetMetadata(JNIEnv* env, jclass clazz, jlong transactionObj,
jlong nativeObject, jint id, jobject parcelObj) {
Parcel* parcel = parcelForJavaObject(env, parcelObj);
@@ -1246,7 +1251,9 @@
"(Landroid/os/IBinder;JJ)Landroid/hardware/display/DisplayedContentSample;",
(void*)nativeGetDisplayedContentSample },
{"nativeSetGeometry", "(JJLandroid/graphics/Rect;Landroid/graphics/Rect;J)V",
- (void*)nativeSetGeometry }
+ (void*)nativeSetGeometry },
+ {"nativeSyncInputWindows", "(J)V",
+ (void*)nativeSyncInputWindows }
};
int register_android_view_SurfaceControl(JNIEnv* env)
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index cccb40d..c1cbd52 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -920,8 +920,7 @@
// Temperature at which the high temperature warning notification should
// be shown.
optional SettingProto warning_temperature_level = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
- // USB temperature at which the high temperature alarm notification should be shown.
- optional SettingProto usb_alarm_temperature_level = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ optional SettingProto show_usb_temperature_alarm = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
optional TemperatureWarning temperature_warning = 119;
diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
index 9fabe44..d73c174 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java
@@ -28,6 +28,7 @@
import android.app.IInstrumentationWatcher;
import android.app.IUiAutomationConnection;
import android.app.ProfilerInfo;
+import android.content.AutofillOptions;
import android.content.ComponentName;
import android.content.ContentCaptureOptions;
import android.content.IIntentReceiver;
@@ -407,7 +408,7 @@
IUiAutomationConnection iUiAutomationConnection, int i, boolean b, boolean b1,
boolean b2, boolean b3, Configuration configuration,
CompatibilityInfo compatibilityInfo, Map map, Bundle bundle1, String s1,
- boolean autofillCompatEnabled, ContentCaptureOptions o) throws RemoteException {
+ AutofillOptions ao, ContentCaptureOptions co) throws RemoteException {
}
@Override
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 46cac7a..3a1a4fc 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -429,6 +429,7 @@
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
Settings.Global.SHOW_RESTART_IN_CRASH_DIALOG,
Settings.Global.SHOW_TEMPERATURE_WARNING,
+ Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
Settings.Global.SIGNED_CONFIG_VERSION,
Settings.Global.SMART_SELECTION_UPDATE_CONTENT_URL,
Settings.Global.SMART_SELECTION_UPDATE_METADATA_URL,
@@ -504,7 +505,6 @@
Settings.Global.USER_SWITCHER_ENABLED,
Settings.Global.NETWORK_ACCESS_TIMEOUT_MS,
Settings.Global.WARNING_TEMPERATURE,
- Settings.Global.USB_ALARM_TEMPERATURE,
Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
Settings.Global.WEBVIEW_FALLBACK_LOGIC_ENABLED,
Settings.Global.WEBVIEW_MULTIPROCESS,
diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java
index 6264774..15d855e 100644
--- a/graphics/java/android/graphics/ImageFormat.java
+++ b/graphics/java/android/graphics/ImageFormat.java
@@ -16,7 +16,43 @@
package android.graphics;
+import android.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
public class ImageFormat {
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(value = {
+ UNKNOWN,
+ RGB_565,
+ YV12,
+ Y8,
+ Y16,
+ NV16,
+ NV21,
+ YUY2,
+ JPEG,
+ DEPTH_JPEG,
+ YUV_420_888,
+ YUV_422_888,
+ YUV_444_888,
+ FLEX_RGB_888,
+ FLEX_RGBA_8888,
+ RAW_SENSOR,
+ RAW_PRIVATE,
+ RAW10,
+ RAW12,
+ DEPTH16,
+ DEPTH_POINT_CLOUD,
+ RAW_DEPTH,
+ PRIVATE,
+ HEIC
+ })
+ public @interface Format {
+ }
+
/*
* these constants are chosen to be binary compatible with their previous
* location in PixelFormat.java
@@ -731,7 +767,7 @@
* @return the number of bits per pixel of the given format or -1 if the
* format doesn't exist or is not supported.
*/
- public static int getBitsPerPixel(int format) {
+ public static int getBitsPerPixel(@Format int format) {
switch (format) {
case RGB_565:
return 16;
@@ -781,7 +817,7 @@
*
* @hide
*/
- public static boolean isPublicFormat(int format) {
+ public static boolean isPublicFormat(@Format int format) {
switch (format) {
case RGB_565:
case NV16:
diff --git a/media/java/android/media/ImageReader.java b/media/java/android/media/ImageReader.java
index 6116429..ba87f2b 100644
--- a/media/java/android/media/ImageReader.java
+++ b/media/java/android/media/ImageReader.java
@@ -16,8 +16,12 @@
package android.media;
+import android.annotation.IntRange;
+import android.annotation.NonNull;
import android.graphics.ImageFormat;
+import android.graphics.ImageFormat.Format;
import android.hardware.HardwareBuffer;
+import android.hardware.HardwareBuffer.Usage;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -120,7 +124,11 @@
* Must be greater than 0.
* @see Image
*/
- public static ImageReader newInstance(int width, int height, int format, int maxImages) {
+ public static @NonNull ImageReader newInstance(
+ @IntRange(from = 1) int width,
+ @IntRange(from = 1) int height,
+ @Format int format,
+ @IntRange(from = 1) int maxImages) {
// If the format is private don't default to USAGE_CPU_READ_OFTEN since it may not
// work, and is inscrutable anyway
return new ImageReader(width, height, format, maxImages,
@@ -210,8 +218,12 @@
* @see Image
* @see HardwareBuffer
*/
- public static ImageReader newInstance(int width, int height, int format, int maxImages,
- long usage) {
+ public static @NonNull ImageReader newInstance(
+ @IntRange(from = 1) int width,
+ @IntRange(from = 1) int height,
+ @Format int format,
+ @IntRange(from = 1) int maxImages,
+ @Usage long usage) {
// TODO: Check this - can't do it just yet because format support is different
// Unify formats! The only reliable way to validate usage is to just try it and see.
diff --git a/media/java/android/media/ImageWriter.java b/media/java/android/media/ImageWriter.java
index dd09afc..f813d1b 100644
--- a/media/java/android/media/ImageWriter.java
+++ b/media/java/android/media/ImageWriter.java
@@ -16,7 +16,10 @@
package android.media;
+import android.annotation.IntRange;
+import android.annotation.NonNull;
import android.graphics.ImageFormat;
+import android.graphics.ImageFormat.Format;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.hardware.camera2.utils.SurfaceUtils;
@@ -124,7 +127,8 @@
* {@link #dequeueInputImage()}.
* @return a new ImageWriter instance.
*/
- public static ImageWriter newInstance(Surface surface, int maxImages) {
+ public static @NonNull ImageWriter newInstance(@NonNull Surface surface,
+ @IntRange(from = 1) int maxImages) {
return new ImageWriter(surface, maxImages, ImageFormat.UNKNOWN);
}
@@ -169,7 +173,8 @@
*
* @return a new ImageWriter instance.
*/
- public static ImageWriter newInstance(Surface surface, int maxImages, int format) {
+ public static @NonNull ImageWriter newInstance(@NonNull Surface surface,
+ @IntRange(from = 1) int maxImages, @Format int format) {
if (!ImageFormat.isPublicFormat(format) && !PixelFormat.isPublicFormat(format)) {
throw new IllegalArgumentException("Invalid format is specified: " + format);
}
diff --git a/packages/SettingsLib/res/values-as/strings.xml b/packages/SettingsLib/res/values-as/strings.xml
index f865563..68f1e6f 100644
--- a/packages/SettingsLib/res/values-as/strings.xml
+++ b/packages/SettingsLib/res/values-as/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"আঁতৰোৱা এপ্সমূহ"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"আঁতৰোৱা এপ্ আৰু ব্যৱহাৰকাৰীসমূহ"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"ছিষ্টেম আপডে’ট"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"ইউএছবি টেডাৰিং"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"প\'ৰ্টেবল হটস্পট"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ব্লুটুথ টেডাৰিং"</string>
diff --git a/packages/SettingsLib/res/values-bn/strings.xml b/packages/SettingsLib/res/values-bn/strings.xml
index ef8dd3d..4f29131 100644
--- a/packages/SettingsLib/res/values-bn/strings.xml
+++ b/packages/SettingsLib/res/values-bn/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"সরানো অ্যাপ্লিকেশানগুলি"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"সরানো অ্যাপ্লিকেশানগুলি এবং ব্যবহারকারীগণ"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"সিস্টেম আপডেট"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB টিথারিং"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"পোর্টেবল হটস্পট"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ব্লুটুথ টিথারিং"</string>
diff --git a/packages/SettingsLib/res/values-gu/strings.xml b/packages/SettingsLib/res/values-gu/strings.xml
index 97b9036..36e04bb 100644
--- a/packages/SettingsLib/res/values-gu/strings.xml
+++ b/packages/SettingsLib/res/values-gu/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"દૂર કરેલી ઍપ્લિકેશનો"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"દૂર કરેલી ઍપ્લિકેશનો અને વપરાશકર્તાઓ"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"સિસ્ટમ અપડેટ"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ટિથરિંગ"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"પોર્ટેબલ હૉટસ્પૉટ"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"બ્લૂટૂથ ટિથરિંગ"</string>
diff --git a/packages/SettingsLib/res/values-iw/strings.xml b/packages/SettingsLib/res/values-iw/strings.xml
index 6e37c9a..89d6361 100644
--- a/packages/SettingsLib/res/values-iw/strings.xml
+++ b/packages/SettingsLib/res/values-iw/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"אפליקציות שהוסרו"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"אפליקציות ומשתמשים שהוסרו"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"עדכוני מערכת"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"שיתוף אינטרנט דרך USB"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"נקודה לשיתוף אינטרנט"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"שיתוף אינטרנט דרך Bluetooth"</string>
diff --git a/packages/SettingsLib/res/values-kn/strings.xml b/packages/SettingsLib/res/values-kn/strings.xml
index 41b0fbd..1e9a0d5 100644
--- a/packages/SettingsLib/res/values-kn/strings.xml
+++ b/packages/SettingsLib/res/values-kn/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"ತೆಗೆದುಹಾಕಲಾದ ಅಪ್ಲಿಕೇಶನ್ಗಳು"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"ಅಪ್ಲಿಕೇಶನ್ಗಳು ಮತ್ತು ಬಳಕೆದಾರರನ್ನು ತೆಗೆದುಹಾಕಲಾಗಿದೆ"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"ಸಿಸ್ಟಂ ಅಪ್ಡೇಟ್ಗಳು"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ಟೆಥರಿಂಗ್"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"ಪೋರ್ಟಬಲ್ ಹಾಟ್ಸ್ಪಾಟ್"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ಬ್ಲೂಟೂತ್ ಟೆಥರಿಂಗ್"</string>
diff --git a/packages/SettingsLib/res/values-ml/strings.xml b/packages/SettingsLib/res/values-ml/strings.xml
index 0292cab..ae97fb2 100644
--- a/packages/SettingsLib/res/values-ml/strings.xml
+++ b/packages/SettingsLib/res/values-ml/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"നീക്കംചെയ്ത അപ്ലിക്കേഷനുകൾ"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"നീക്കംചെയ്ത അപ്ലിക്കേഷനുകളും ഉപയോക്താക്കളും"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"സിസ്റ്റം അപ്ഡേറ്റുകൾ"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ടെതറിംഗ്"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"പോർട്ടബിൾ ഹോട്ട്സ്പോട്ട്"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ബ്ലൂടൂത്ത് ടെതറിംഗ്"</string>
diff --git a/packages/SettingsLib/res/values-mr/strings.xml b/packages/SettingsLib/res/values-mr/strings.xml
index 0c2f0ee..88de8f4 100644
--- a/packages/SettingsLib/res/values-mr/strings.xml
+++ b/packages/SettingsLib/res/values-mr/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"काढलेले अॅप्स"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"काढलेले अॅप्स आणि वापरकर्ते"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"सिस्टम अपडेट"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB टेदरिंग"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"पोर्टेबल हॉटस्पॉट"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ब्लूटूथ टेदरिंग"</string>
diff --git a/packages/SettingsLib/res/values-ne/strings.xml b/packages/SettingsLib/res/values-ne/strings.xml
index 7daf956..ac15f1b 100644
--- a/packages/SettingsLib/res/values-ne/strings.xml
+++ b/packages/SettingsLib/res/values-ne/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"एन्ड्रोइड OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"हटाइएका अनुप्रयोगहरू"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"अनुप्रयोगहरू र प्रयोगकर्ताहरू हटाइयो।"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"प्रणालीसम्बन्धी अद्यावधिकहरू"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB टेथर गर्दै"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"पोर्टेबल हटस्पट"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ब्लुटुथ टेथर गर्दै"</string>
diff --git a/packages/SettingsLib/res/values-or/strings.xml b/packages/SettingsLib/res/values-or/strings.xml
index 54ddf84..847586e 100644
--- a/packages/SettingsLib/res/values-or/strings.xml
+++ b/packages/SettingsLib/res/values-or/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"କଢ଼ାଯାଇଥିବା ଆପ୍ଗୁଡ଼ିକ"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"ଆପ୍ ଏବଂ ଉପଯୋଗକର୍ତ୍ତା ବାହାର କରାଗଲା"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"ସିଷ୍ଟମ୍ ଅପ୍ଡେଟ୍"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ଟିଥରିଙ୍ଗ"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"ପୋର୍ଟବଲ୍ ହଟସ୍ପଟ୍"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ବ୍ଲୁଟୂଥ ଟିଥରିଙ୍ଗ"</string>
diff --git a/packages/SettingsLib/res/values-pa/strings.xml b/packages/SettingsLib/res/values-pa/strings.xml
index dcf3e3c..0675b6b 100644
--- a/packages/SettingsLib/res/values-pa/strings.xml
+++ b/packages/SettingsLib/res/values-pa/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"ਹਟਾਏ ਗਏ ਐਪਸ"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"ਹਟਾਏ ਗਏ ਐਪਸ ਅਤੇ ਉਪਭੋਗਤਾ"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"ਸਿਸਟਮ ਅੱਪਡੇਟ"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ਟੈਦਰਿੰਗ"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"ਪੋਰਟੇਬਲ ਹੌਟਸਪੌਟ"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"ਬਲੂਟੁੱਥ ਟੈਦਰਿੰਗ"</string>
diff --git a/packages/SettingsLib/res/values-ta/strings.xml b/packages/SettingsLib/res/values-ta/strings.xml
index 71716ce..3cf43c8 100644
--- a/packages/SettingsLib/res/values-ta/strings.xml
+++ b/packages/SettingsLib/res/values-ta/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"அகற்றப்பட்ட பயன்பாடுகள்"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"அகற்றப்பட்ட பயன்பாடுகள் மற்றும் பயனர்கள்"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"சிஸ்டம் புதுப்பிப்புகள்"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB டெதெரிங்"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"போர்ட்டபிள் ஹாட்ஸ்பாட்"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"புளூடூத் டெதெரிங்"</string>
diff --git a/packages/SettingsLib/res/values-ur/strings.xml b/packages/SettingsLib/res/values-ur/strings.xml
index 65ed110..c223629 100644
--- a/packages/SettingsLib/res/values-ur/strings.xml
+++ b/packages/SettingsLib/res/values-ur/strings.xml
@@ -136,8 +136,7 @@
<string name="process_kernel_label" msgid="3916858646836739323">"Android OS"</string>
<string name="data_usage_uninstalled_apps" msgid="614263770923231598">"ہٹائی گئی ایپس"</string>
<string name="data_usage_uninstalled_apps_users" msgid="7986294489899813194">"ہٹائی گئی ایپس اور صارفین"</string>
- <!-- no translation found for data_usage_ota (5377889154805560860) -->
- <skip />
+ <string name="data_usage_ota" msgid="5377889154805560860">"سسٹم اپ ڈیٹس"</string>
<string name="tether_settings_title_usb" msgid="6688416425801386511">"USB ٹیدرنگ"</string>
<string name="tether_settings_title_wifi" msgid="3277144155960302049">"پورٹیبل ہاٹ اسپاٹ"</string>
<string name="tether_settings_title_bluetooth" msgid="355855408317564420">"بلوٹوتھ ٹیدرنگ"</string>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index 81b304d..0f8fd92 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -1353,11 +1353,11 @@
Settings.Global.SHOW_TEMPERATURE_WARNING,
GlobalSettingsProto.TemperatureWarning.SHOW_TEMPERATURE_WARNING);
dumpSetting(s, p,
+ Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
+ GlobalSettingsProto.TemperatureWarning.SHOW_USB_TEMPERATURE_ALARM);
+ dumpSetting(s, p,
Settings.Global.WARNING_TEMPERATURE,
GlobalSettingsProto.TemperatureWarning.WARNING_TEMPERATURE_LEVEL);
- dumpSetting(s, p,
- Settings.Global.USB_ALARM_TEMPERATURE,
- GlobalSettingsProto.TemperatureWarning.USB_ALARM_TEMPERATURE_LEVEL);
p.end(tempWarningToken);
final long tetherToken = p.start(GlobalSettingsProto.TETHER);
diff --git a/packages/SystemUI/res/layout/bubble_expanded_view.xml b/packages/SystemUI/res/layout/bubble_expanded_view.xml
index f664c05..a8b1b2e 100644
--- a/packages/SystemUI/res/layout/bubble_expanded_view.xml
+++ b/packages/SystemUI/res/layout/bubble_expanded_view.xml
@@ -39,26 +39,13 @@
android:layout_height="@dimen/bubble_expanded_header_height"
android:layout_width="match_parent"
android:animateLayoutChanges="true"
+ android:gravity="end|center_vertical"
android:orientation="horizontal">
- <TextView
- android:id="@+id/header_text"
- android:textAppearance="@*android:style/TextAppearance.Material.Title"
- android:textSize="18sp"
- android:layout_weight="1"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:gravity="start|center_vertical"
- android:singleLine="true"
- android:paddingLeft="@dimen/bubble_expanded_header_horizontal_padding"
- android:paddingRight="@dimen/bubble_expanded_header_horizontal_padding"
- />
-
<ImageButton
android:id="@+id/deep_link_button"
android:layout_width="@dimen/bubble_header_icon_size"
android:layout_height="@dimen/bubble_header_icon_size"
- android:gravity="end|center_vertical"
android:src="@drawable/ic_open_in_new"
android:scaleType="center"
android:tint="?android:attr/colorForeground"
@@ -70,7 +57,6 @@
android:layout_width="@dimen/bubble_header_icon_size"
android:layout_height="@dimen/bubble_header_icon_size"
android:src="@drawable/ic_settings"
- android:gravity="end|center_vertical"
android:scaleType="center"
android:tint="?android:attr/colorForeground"
android:background="?android:attr/selectableItemBackground"
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 4396a42..b4dc0eff 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -329,16 +329,11 @@
<bool name="quick_settings_show_full_alarm">false</bool>
- <!-- Whether to show a warning notification when the device reaches a certain temperature. -->
+ <!-- Whether to show a warning notification when device's skin temperature is high. -->
<integer name="config_showTemperatureWarning">0</integer>
- <!-- Temp at which to show a warning notification if config_showTemperatureWarning is true.
- If < 0, uses the skin temperature sensor shutdown value from
- HardwarePropertiesManager#getDeviceTemperatures - config_warningTemperatureTolerance. -->
- <integer name="config_warningTemperature">-1</integer>
-
- <!-- Fudge factor for how much below the shutdown temp to show the warning. -->
- <integer name="config_warningTemperatureTolerance">2</integer>
+ <!-- Whether to show a alarm dialog when device's usb port is overheating. -->
+ <integer name="config_showUsbPortAlarm">0</integer>
<!-- Accessibility actions -->
<item type="id" name="action_split_task_to_left" />
@@ -485,4 +480,5 @@
</string-array>
<integer name="ongoing_appops_dialog_max_apps">5</integer>
+
</resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 371a060..1f6e3c2 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1012,7 +1012,7 @@
<!-- How much to inset the icon in the circle -->
<dimen name="bubble_icon_inset">16dp</dimen>
<!-- Padding around the view displayed when the bubble is expanded -->
- <dimen name="bubble_expanded_view_padding">8dp</dimen>
+ <dimen name="bubble_expanded_view_padding">4dp</dimen>
<!-- Default (and minimum) height of the expanded view shown when the bubble is expanded -->
<dimen name="bubble_expanded_default_height">180dp</dimen>
<!-- Height of the triangle that points to the expanded bubble -->
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 0fde2de..4905e57 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2118,6 +2118,14 @@
<string name="high_temp_notif_message">Some features limited while phone cools down</string>
<!-- Text body for dialog alerting user that their phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=300] -->
<string name="high_temp_dialog_message">Your phone will automatically try to cool down. You can still use your phone, but it may run slower.\n\nOnce your phone has cooled down, it will run normally.</string>
+ <!-- Title for alarm dialog alerting user the usb adapter has reached a certain temperature that should disconnect charging cable immediately. [CHAR LIMIT=30] -->
+ <string name="high_temp_alarm_title">Unplug charger</string>
+ <!-- Text body for dialog alerting user the usb adapter has reached a certain temperature that should disconnect charging cable immediately. [CHAR LIMIT=300] -->
+ <string name="high_temp_alarm_notify_message">There\u2019s an issue charging this device. Unplug the power adapter, and take care as the cable may be warm.</string>
+ <!-- Text for See care steps button [CHAR LIMIT=300] -->
+ <string name="high_temp_alarm_help_care_steps">See care steps</string>
+ <!-- Text link directs to usb overheat help page. -->
+ <string name="high_temp_alarm_help_url" translatable="false">help_uri_usb_warm</string>
<!-- SysUI Tuner: Button to select lock screen shortcut [CHAR LIMIT=60] -->
<string name="lockscreen_shortcut_left">Left shortcut</string>
@@ -2378,5 +2386,4 @@
<string name="no_bubbles">Block</string>
<!-- Text used for button allowing user to approve / enable bubbles [CHAR LIMIT=20] -->
<string name="yes_bubbles">Allow</string>
-
</resources>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/PinnedStackListenerForwarder.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/PinnedStackListenerForwarder.java
new file mode 100644
index 0000000..3ae2df5b
--- /dev/null
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/PinnedStackListenerForwarder.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.shared.system;
+
+import android.content.pm.ParceledListSlice;
+import android.graphics.Rect;
+import android.os.RemoteException;
+import android.view.IPinnedStackController;
+import android.view.IPinnedStackListener;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * PinnedStackListener that simply forwards all calls to each listener added via
+ * {@link #addListener}. This is necessary since calling
+ * {@link com.android.server.wm.WindowManagerService#registerPinnedStackListener} replaces any
+ * previously set listener.
+ */
+public class PinnedStackListenerForwarder extends IPinnedStackListener.Stub {
+ private List<IPinnedStackListener> mListeners = new ArrayList<>();
+
+ /** Adds a listener to receive updates from the WindowManagerService. */
+ public void addListener(IPinnedStackListener listener) {
+ mListeners.add(listener);
+ }
+
+ /** Removes a listener so it will no longer receive updates from the WindowManagerService. */
+ public void removeListener(IPinnedStackListener listener) {
+ mListeners.remove(listener);
+ }
+
+ @Override
+ public void onListenerRegistered(IPinnedStackController controller) throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onListenerRegistered(controller);
+ }
+ }
+
+ @Override
+ public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect animatingBounds,
+ boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation)
+ throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onMovementBoundsChanged(
+ insetBounds, normalBounds, animatingBounds,
+ fromImeAdjustment, fromShelfAdjustment, displayRotation);
+ }
+ }
+
+ @Override
+ public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onImeVisibilityChanged(imeVisible, imeHeight);
+ }
+ }
+
+ @Override
+ public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight)
+ throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onShelfVisibilityChanged(shelfVisible, shelfHeight);
+ }
+ }
+
+ @Override
+ public void onMinimizedStateChanged(boolean isMinimized) throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onMinimizedStateChanged(isMinimized);
+ }
+ }
+
+ @Override
+ public void onActionsChanged(ParceledListSlice actions) throws RemoteException {
+ for (IPinnedStackListener listener : mListeners) {
+ listener.onActionsChanged(actions);
+ }
+ }
+}
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
index 8a251ae..10996e88 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
@@ -27,6 +27,7 @@
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
+import android.view.IPinnedStackListener;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
@@ -81,6 +82,13 @@
private static final WindowManagerWrapper sInstance = new WindowManagerWrapper();
+ /**
+ * Forwarder to which we can add multiple pinned stack listeners. Each listener will receive
+ * updates from the window manager service.
+ */
+ private PinnedStackListenerForwarder mPinnedStackListenerForwarder =
+ new PinnedStackListenerForwarder();
+
public static WindowManagerWrapper getInstance() {
return sInstance;
}
@@ -199,4 +207,14 @@
Log.w(TAG, "Failed to register docked stack listener");
}
}
+
+ /**
+ * Adds a pinned stack listener, which will receive updates from the window manager service
+ * along with any other pinned stack listeners that were added via this method.
+ */
+ public void addPinnedStackListener(IPinnedStackListener listener) throws RemoteException {
+ mPinnedStackListenerForwarder.addListener(listener);
+ WindowManagerGlobal.getWindowManagerService().registerPinnedStackListener(
+ DEFAULT_DISPLAY, mPinnedStackListenerForwarder);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index 9efa656..60e6083 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -474,8 +474,6 @@
if (anim == null) {
return;
}
- int duration = SNAP_ANIM_LEN;
- anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
boolean wasCancelled = false;
@@ -495,6 +493,9 @@
});
prepareSnapBackAnimation(animView, anim);
mSnappingChild = true;
+ float maxDistance = Math.abs(targetLeft - getTranslation(animView));
+ mFlingAnimationUtils.apply(anim, getTranslation(animView), targetLeft, velocity,
+ maxDistance);
anim.start();
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 505fbae..4eea9f8 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -31,12 +31,15 @@
import android.app.INotificationManager;
import android.app.Notification;
import android.content.Context;
+import android.content.pm.ParceledListSlice;
import android.graphics.Rect;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.view.Display;
+import android.view.IPinnedStackController;
+import android.view.IPinnedStackListener;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@@ -49,6 +52,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
+import com.android.systemui.shared.system.WindowManagerWrapper;
import com.android.systemui.statusbar.notification.NotificationEntryListener;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
@@ -173,6 +177,12 @@
mTaskStackListener = new BubbleTaskStackListener();
ActivityManagerWrapper.getInstance().registerTaskStackListener(mTaskStackListener);
+ try {
+ WindowManagerWrapper.getInstance().addPinnedStackListener(new BubblesImeListener());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+
mBubbleData = data;
}
@@ -537,4 +547,37 @@
return Settings.Secure.getInt(context.getContentResolver(),
ENABLE_BUBBLES, 1) != 0;
}
+
+ /** PinnedStackListener that dispatches IME visibility updates to the stack. */
+ private class BubblesImeListener extends IPinnedStackListener.Stub {
+
+ @Override
+ public void onListenerRegistered(IPinnedStackController controller) throws RemoteException {
+ }
+
+ @Override
+ public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds,
+ Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment,
+ int displayRotation) throws RemoteException {}
+
+ @Override
+ public void onImeVisibilityChanged(boolean imeVisible, int imeHeight)
+ throws RemoteException {
+ if (mStackView != null) {
+ mStackView.post(() -> {
+ mStackView.onImeVisibilityChanged(imeVisible, imeHeight);
+ });
+ }
+ }
+
+ @Override
+ public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight)
+ throws RemoteException {}
+
+ @Override
+ public void onMinimizedStateChanged(boolean isMinimized) throws RemoteException {}
+
+ @Override
+ public void onActionsChanged(ParceledListSlice actions) throws RemoteException {}
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index c2327ad..7884800 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -75,7 +75,6 @@
// Header
private View mHeaderView;
- private TextView mHeaderTextView;
private ImageButton mDeepLinkIcon;
private ImageButton mSettingsIcon;
@@ -197,7 +196,6 @@
mHeaderHeight = getContext().getResources().getDimensionPixelSize(
R.dimen.bubble_expanded_header_height);
mHeaderView = findViewById(R.id.header_layout);
- mHeaderTextView = findViewById(R.id.header_text);
mDeepLinkIcon = findViewById(R.id.deep_link_button);
mSettingsIcon = findViewById(R.id.settings_button);
mDeepLinkIcon.setOnClickListener(this);
@@ -295,13 +293,6 @@
R.string.bubbles_settings_button_description, mAppName));
mDeepLinkIcon.setContentDescription(getResources().getString(
R.string.bubbles_deep_link_button_description, mAppName));
- if (mEntry != null && mEntry.getBubbleMetadata() != null) {
- mHeaderTextView.setText(mEntry.getBubbleMetadata().getTitle());
- } else {
- // This should only happen if we're auto-bubbling notification content that isn't
- // explicitly a bubble
- mHeaderTextView.setText(mAppName);
- }
}
private void updatePermissionView() {
@@ -321,6 +312,8 @@
mPermissionView.setVisibility(VISIBLE);
((ImageView) mPermissionView.findViewById(R.id.pkgicon)).setImageDrawable(mAppIcon);
((TextView) mPermissionView.findViewById(R.id.pkgname)).setText(mAppName);
+ logBubbleClickEvent(mEntry.notification,
+ StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_DIALOG_SHOWN);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 5546e4c..e20be8e 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -100,6 +100,7 @@
private int mExpandedAnimateYDistance;
private int mStatusBarHeight;
private int mPipDismissHeight;
+ private int mImeOffset;
private Bubble mExpandedBubble;
private boolean mIsExpanded;
@@ -162,6 +163,7 @@
res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height);
mPipDismissHeight = mContext.getResources().getDimensionPixelSize(
R.dimen.pip_dismiss_gradient_height);
+ mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset);
mDisplaySize = new Point();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
@@ -550,8 +552,15 @@
: null;
}
- public PointF getStackPosition() {
- return mStackAnimationController.getStackPosition();
+ /** Moves the bubbles out of the way if they're going to be over the keyboard. */
+ public void onImeVisibilityChanged(boolean visible, int height) {
+ if (!mIsExpanded) {
+ if (visible) {
+ mStackAnimationController.updateBoundsForVisibleImeAndAnimate(height + mImeOffset);
+ } else {
+ mStackAnimationController.updateBoundsForInvisibleImeAndAnimate();
+ }
+ }
}
/** Called when a drag operation on an individual bubble has started. */
@@ -786,7 +795,10 @@
* @return the index of the bubble view within the bubble stack. The range of the position
* is between 0 and the bubble count minus 1.
*/
- int getBubbleIndex(Bubble bubble) {
+ int getBubbleIndex(@Nullable Bubble bubble) {
+ if (bubble == null) {
+ return 0;
+ }
return mBubbleContainer.indexOfChild(bubble.iconView);
}
@@ -808,6 +820,10 @@
.floatValue();
}
+ public PointF getStackPosition() {
+ return mStackAnimationController.getStackPosition();
+ }
+
/**
* Logs the bubble UI event.
*
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
index 7dfb21c..f47fbe0 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/animation/StackAnimationController.java
@@ -66,6 +66,15 @@
*/
private PointF mStackPosition = new PointF();
+ /** The height of the most recently visible IME. */
+ private float mImeHeight = 0f;
+
+ /**
+ * The Y position of the stack before the IME became visible, or {@link Float#MIN_VALUE} if the
+ * IME is not visible or the user moved the stack since the IME became visible.
+ */
+ private float mPreImeY = Float.MIN_VALUE;
+
/**
* Animations on the stack position itself, which would have been started in
* {@link #flingThenSpringFirstBubbleWithStackFollowing}. These animations dispatch to
@@ -108,6 +117,10 @@
* it with the 'following' effect.
*/
public void moveFirstBubbleWithStackFollowing(float x, float y) {
+ // If we manually move the bubbles with the IME open, clear the return point since we don't
+ // want the stack to snap away from the new position.
+ mPreImeY = Float.MIN_VALUE;
+
moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_X, x);
moveFirstBubbleWithStackFollowing(DynamicAnimation.TRANSLATION_Y, y);
}
@@ -189,6 +202,44 @@
}
/**
+ * Save the IME height so that the allowable stack bounds reflect the now-visible IME, and
+ * animate the stack out of the way if necessary.
+ */
+ public void updateBoundsForVisibleImeAndAnimate(int imeHeight) {
+ mImeHeight = imeHeight;
+
+ final float maxBubbleY = getAllowableStackPositionRegion().bottom;
+ if (mStackPosition.y > maxBubbleY && mPreImeY == Float.MIN_VALUE) {
+ mPreImeY = mStackPosition.y;
+
+ springFirstBubbleWithStackFollowing(
+ DynamicAnimation.TRANSLATION_Y,
+ getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
+ .setStiffness(SpringForce.STIFFNESS_LOW),
+ /* startVel */ 0f,
+ maxBubbleY);
+ }
+ }
+
+ /**
+ * Clear the IME height from the bounds and animate the stack back to its original position,
+ * assuming it wasn't moved in the meantime.
+ */
+ public void updateBoundsForInvisibleImeAndAnimate() {
+ mImeHeight = 0;
+
+ if (mPreImeY > Float.MIN_VALUE) {
+ springFirstBubbleWithStackFollowing(
+ DynamicAnimation.TRANSLATION_Y,
+ getSpringForce(DynamicAnimation.TRANSLATION_Y, /* view */ null)
+ .setStiffness(SpringForce.STIFFNESS_LOW),
+ /* startVel */ 0f,
+ mPreImeY);
+ mPreImeY = Float.MIN_VALUE;
+ }
+ }
+
+ /**
* Returns the region within which the stack is allowed to rest. This goes slightly off the left
* and right sides of the screen, below the status bar/cutout and above the navigation bar.
* While the stack is not allowed to rest outside of these bounds, it can temporarily be
@@ -228,6 +279,7 @@
mLayout.getHeight()
- mIndividualBubbleSize
- mBubblePadding
+ - (mImeHeight > Float.MIN_VALUE ? mImeHeight + mBubblePadding : 0f)
- Math.max(
insets.getSystemWindowInsetBottom(),
insets.getDisplayCutout() != null
@@ -389,8 +441,8 @@
float vel, float finalPosition) {
Log.d(TAG, String.format("Springing %s to final position %f.",
- PhysicsAnimationLayout.getReadablePropertyName(property),
- finalPosition));
+ PhysicsAnimationLayout.getReadablePropertyName(property),
+ finalPosition));
StackPositionProperty firstBubbleProperty = new StackPositionProperty(property);
SpringAnimation springAnimation =
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index 3346ad2..1740290 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -16,8 +16,6 @@
package com.android.systemui.pip.phone;
-import static android.view.Display.DEFAULT_DISPLAY;
-
import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.IActivityManager;
@@ -33,8 +31,6 @@
import android.util.Pair;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
-import android.view.IWindowManager;
-import android.view.WindowManagerGlobal;
import com.android.systemui.Dependency;
import com.android.systemui.UiOffloadThread;
@@ -57,7 +53,6 @@
private Context mContext;
private IActivityManager mActivityManager;
private IActivityTaskManager mActivityTaskManager;
- private IWindowManager mWindowManager;
private Handler mHandler = new Handler();
private final PinnedStackListener mPinnedStackListener = new PinnedStackListener();
@@ -178,10 +173,9 @@
mContext = context;
mActivityManager = ActivityManager.getService();
mActivityTaskManager = ActivityTaskManager.getService();
- mWindowManager = WindowManagerGlobal.getWindowManagerService();
try {
- mWindowManager.registerPinnedStackListener(DEFAULT_DISPLAY, mPinnedStackListener);
+ WindowManagerWrapper.getInstance().addPinnedStackListener(mPinnedStackListener);
} catch (RemoteException e) {
Log.e(TAG, "Failed to register pinned stack listener", e);
}
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
index 50dda1c..fdb0b36 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java
@@ -16,6 +16,7 @@
package com.android.systemui.power;
+import android.app.KeyguardManager;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
@@ -41,6 +42,7 @@
import android.util.Log;
import android.util.Slog;
import android.view.View;
+import android.view.WindowManager;
import androidx.annotation.VisibleForTesting;
@@ -48,10 +50,13 @@
import com.android.settingslib.Utils;
import com.android.settingslib.fuelgauge.BatterySaverUtils;
import com.android.settingslib.utils.PowerUtil;
+import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
+import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.util.NotificationChannels;
+import com.android.systemui.volume.Events;
import java.io.PrintWriter;
import java.text.NumberFormat;
@@ -118,6 +123,7 @@
private final Context mContext;
private final NotificationManager mNoMan;
private final PowerManager mPowerMan;
+ private final KeyguardManager mKeyguard;
private final Handler mHandler = new Handler(Looper.getMainLooper());
private final Receiver mReceiver = new Receiver();
private final Intent mOpenBatterySettings = settings(Intent.ACTION_POWER_USAGE_SUMMARY);
@@ -141,6 +147,7 @@
private boolean mHighTempWarning;
private SystemUIDialog mHighTempDialog;
private SystemUIDialog mThermalShutdownDialog;
+ @VisibleForTesting SystemUIDialog mUsbHighTempDialog;
/**
*/
@@ -149,6 +156,7 @@
mContext = context;
mNoMan = mContext.getSystemService(NotificationManager.class);
mPowerMan = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ mKeyguard = mContext.getSystemService(KeyguardManager.class);
mReceiver.init();
}
@@ -165,6 +173,8 @@
pw.print("mHighTempDialog="); pw.println(mHighTempDialog != null ? "not null" : null);
pw.print("mThermalShutdownDialog=");
pw.println(mThermalShutdownDialog != null ? "not null" : null);
+ pw.print("mUsbHighTempDialog=");
+ pw.println(mUsbHighTempDialog != null ? "not null" : null);
}
private int getLowBatteryAutoTriggerDefaultLevel() {
@@ -434,6 +444,53 @@
}
@Override
+ public void showUsbHighTemperatureAlarm() {
+ mHandler.post(() -> showUsbHighTemperatureAlarmInternal());
+ }
+
+ private void showUsbHighTemperatureAlarmInternal() {
+ if (mUsbHighTempDialog != null) {
+ return;
+ }
+
+ final SystemUIDialog d = new SystemUIDialog(mContext, R.style.Theme_SystemUI_Dialog_Alert);
+ d.setCancelable(false);
+ d.setIconAttribute(android.R.attr.alertDialogIcon);
+ d.setTitle(R.string.high_temp_alarm_title);
+ d.setShowForAllUsers(true);
+ d.setMessage(mContext.getString(R.string.high_temp_alarm_notify_message, ""));
+ d.setPositiveButton((com.android.internal.R.string.ok),
+ (dialogInterface, which) -> mUsbHighTempDialog = null);
+ d.setNegativeButton((R.string.high_temp_alarm_help_care_steps),
+ (dialogInterface, which) -> {
+ final String contextString = mContext.getString(
+ R.string.high_temp_alarm_help_url);
+ final Intent helpIntent = new Intent();
+ helpIntent.setClassName("com.android.settings",
+ "com.android.settings.HelpTrampoline");
+ helpIntent.putExtra(Intent.EXTRA_TEXT, contextString);
+ Dependency.get(ActivityStarter.class).startActivity(helpIntent,
+ true /* dismissShade */, resultCode -> {
+ mUsbHighTempDialog = null;
+ });
+ });
+ d.setOnDismissListener(dialogInterface -> {
+ mUsbHighTempDialog = null;
+ Events.writeEvent(mContext, Events.EVENT_DISMISS_USB_OVERHEAT_ALARM,
+ Events.DISMISS_REASON_USB_OVERHEAD_ALARM_CHANGED,
+ mKeyguard.isKeyguardLocked());
+ });
+ d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
+ | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ d.show();
+ mUsbHighTempDialog = d;
+
+ Events.writeEvent(mContext, Events.EVENT_SHOW_USB_OVERHEAT_ALARM,
+ Events.SHOW_REASON_USB_OVERHEAD_ALARM_CHANGED,
+ mKeyguard.isKeyguardLocked());
+ }
+
+ @Override
public void updateLowBatteryWarning() {
updateNotification();
}
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index c43f572..7312cbc 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -43,7 +43,6 @@
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.logging.MetricsLogger;
import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -82,26 +81,19 @@
private boolean mLowWarningShownThisChargeCycle;
private boolean mSevereWarningShownThisChargeCycle;
private Future mLastShowWarningTask;
+ private boolean mEnableSkinTemperatureWarning;
+ private boolean mEnableUsbTemperatureAlarm;
private int mLowBatteryAlertCloseLevel;
private final int[] mLowBatteryReminderLevels = new int[2];
private long mScreenOffTime = -1;
- private float mThresholdTemp;
- private float[] mRecentTemps = new float[MAX_RECENT_TEMPS];
- private int mNumTemps;
- private long mNextLogTime;
@VisibleForTesting IThermalService mThermalService;
@VisibleForTesting int mBatteryLevel = 100;
@VisibleForTesting int mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN;
- // by using the same instance (method references are not guaranteed to be the same object
- // We create a method reference here so that we are guaranteed that we can remove a callback
- // each time they are created).
- private final Runnable mUpdateTempCallback = this::updateTemperatureWarning;
-
public void start() {
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mHardwarePropertiesManager = (HardwarePropertiesManager)
@@ -128,7 +120,7 @@
// to the temperature being too high.
showThermalShutdownDialog();
- initTemperatureWarning();
+ initTemperature();
}
@Override
@@ -137,7 +129,7 @@
// Safe to modify mLastConfiguration here as it's only updated by the main thread (here).
if ((mLastConfiguration.updateFrom(newConfig) & mask) != 0) {
- mHandler.post(this::initTemperatureWarning);
+ mHandler.post(this::initTemperature);
}
}
@@ -383,30 +375,16 @@
return canShowWarning || canShowSevereWarning;
}
- private void initTemperatureWarning() {
+ private void initTemperature() {
ContentResolver resolver = mContext.getContentResolver();
Resources resources = mContext.getResources();
- if (Settings.Global.getInt(resolver, Settings.Global.SHOW_TEMPERATURE_WARNING,
- resources.getInteger(R.integer.config_showTemperatureWarning)) == 0) {
- return;
- }
- mThresholdTemp = Settings.Global.getFloat(resolver, Settings.Global.WARNING_TEMPERATURE,
- resources.getInteger(R.integer.config_warningTemperature));
-
- if (mThresholdTemp < 0f) {
- // Get the shutdown temperature, adjust for warning tolerance.
- float[] throttlingTemps = mHardwarePropertiesManager.getDeviceTemperatures(
- HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
- HardwarePropertiesManager.TEMPERATURE_SHUTDOWN);
- if (throttlingTemps == null
- || throttlingTemps.length == 0
- || throttlingTemps[0] == HardwarePropertiesManager.UNDEFINED_TEMPERATURE) {
- return;
- }
- mThresholdTemp = throttlingTemps[0] -
- resources.getInteger(R.integer.config_warningTemperatureTolerance);
- }
+ mEnableSkinTemperatureWarning = Settings.Global.getInt(resolver,
+ Settings.Global.SHOW_TEMPERATURE_WARNING,
+ resources.getInteger(R.integer.config_showTemperatureWarning)) != 0;
+ mEnableUsbTemperatureAlarm = Settings.Global.getInt(resolver,
+ Settings.Global.SHOW_USB_TEMPERATURE_ALARM,
+ resources.getInteger(R.integer.config_showUsbPortAlarm)) != 0;
if (mThermalService == null) {
// Enable push notifications of throttling from vendor thermal
@@ -416,21 +394,27 @@
if (b != null) {
mThermalService = IThermalService.Stub.asInterface(b);
- try {
- mThermalService.registerThermalEventListenerWithType(
- new ThermalEventListener(), Temperature.TYPE_SKIN);
- } catch (RemoteException e) {
- // Should never happen.
- }
+ registerThermalEventListener();
} else {
Slog.w(TAG, "cannot find thermalservice, no throttling push notifications");
}
}
+ }
- setNextLogTime();
-
- // We have passed all of the checks, start checking the temp
- mHandler.post(mUpdateTempCallback);
+ @VisibleForTesting
+ void registerThermalEventListener() {
+ try {
+ if (mEnableSkinTemperatureWarning) {
+ mThermalService.registerThermalEventListenerWithType(
+ new ThermalEventSkinListener(), Temperature.TYPE_SKIN);
+ }
+ if (mEnableUsbTemperatureAlarm) {
+ mThermalService.registerThermalEventListenerWithType(
+ new ThermalEventUsbListener(), Temperature.TYPE_USB_PORT);
+ }
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Failed to register thermal callback.", e);
+ }
}
private void showThermalShutdownDialog() {
@@ -440,81 +424,6 @@
}
}
- @VisibleForTesting
- protected void updateTemperatureWarning() {
- float[] temps = mHardwarePropertiesManager.getDeviceTemperatures(
- HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
- HardwarePropertiesManager.TEMPERATURE_CURRENT);
- if (temps.length != 0) {
- float temp = temps[0];
- mRecentTemps[mNumTemps++] = temp;
-
- StatusBar statusBar = getComponent(StatusBar.class);
- if (statusBar != null && !statusBar.isDeviceInVrMode()
- && temp >= mThresholdTemp) {
- logAtTemperatureThreshold(temp);
- mWarnings.showHighTemperatureWarning();
- } else {
- mWarnings.dismissHighTemperatureWarning();
- }
- }
-
- logTemperatureStats();
-
- // Remove any pending callbacks as we only want to enable one
- mHandler.removeCallbacks(mUpdateTempCallback);
- mHandler.postDelayed(mUpdateTempCallback, TEMPERATURE_INTERVAL);
- }
-
- private void logAtTemperatureThreshold(float temp) {
- StringBuilder sb = new StringBuilder();
- sb.append("currentTemp=").append(temp)
- .append(",thresholdTemp=").append(mThresholdTemp)
- .append(",batteryStatus=").append(mBatteryStatus)
- .append(",recentTemps=");
- for (int i = 0; i < mNumTemps; i++) {
- sb.append(mRecentTemps[i]).append(',');
- }
- Slog.i(TAG, sb.toString());
- }
-
- /**
- * Calculates and logs min, max, and average
- * {@link HardwarePropertiesManager#DEVICE_TEMPERATURE_SKIN} over the past
- * {@link #TEMPERATURE_LOGGING_INTERVAL}.
- */
- private void logTemperatureStats() {
- if (mNextLogTime > System.currentTimeMillis() && mNumTemps != MAX_RECENT_TEMPS) {
- return;
- }
-
- if (mNumTemps > 0) {
- float sum = mRecentTemps[0], min = mRecentTemps[0], max = mRecentTemps[0];
- for (int i = 1; i < mNumTemps; i++) {
- float temp = mRecentTemps[i];
- sum += temp;
- if (temp > max) {
- max = temp;
- }
- if (temp < min) {
- min = temp;
- }
- }
-
- float avg = sum / mNumTemps;
- Slog.i(TAG, "avg=" + avg + ",min=" + min + ",max=" + max);
- MetricsLogger.histogram(mContext, "device_skin_temp_avg", (int) avg);
- MetricsLogger.histogram(mContext, "device_skin_temp_min", (int) min);
- MetricsLogger.histogram(mContext, "device_skin_temp_max", (int) max);
- }
- setNextLogTime();
- mNumTemps = 0;
- }
-
- private void setNextLogTime() {
- mNextLogTime = System.currentTimeMillis() + TEMPERATURE_LOGGING_INTERVAL;
- }
-
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.print("mLowBatteryAlertCloseLevel=");
pw.println(mLowBatteryAlertCloseLevel);
@@ -541,34 +450,80 @@
Settings.Global.LOW_BATTERY_SOUND_TIMEOUT, 0));
pw.print("bucket: ");
pw.println(Integer.toString(findBatteryLevelBucket(mBatteryLevel)));
- pw.print("mThresholdTemp=");
- pw.println(Float.toString(mThresholdTemp));
- pw.print("mNextLogTime=");
- pw.println(Long.toString(mNextLogTime));
+ pw.print("mEnableSkinTemperatureWarning=");
+ pw.println(mEnableSkinTemperatureWarning);
+ pw.print("mEnableUsbTemperatureAlarm=");
+ pw.println(mEnableUsbTemperatureAlarm);
mWarnings.dump(pw);
}
public interface WarningsUI {
void update(int batteryLevel, int bucket, long screenOffTime);
+
void updateEstimate(Estimate estimate);
+
void updateThresholds(long lowThreshold, long severeThreshold);
+
void dismissLowBatteryWarning();
+
void showLowBatteryWarning(boolean playSound);
+
void dismissInvalidChargerWarning();
+
void showInvalidChargerWarning();
+
void updateLowBatteryWarning();
+
boolean isInvalidChargerWarningShowing();
+
void dismissHighTemperatureWarning();
+
void showHighTemperatureWarning();
+
+ /**
+ * Display USB overheat alarm
+ */
+ void showUsbHighTemperatureAlarm();
+
void showThermalShutdownWarning();
+
void dump(PrintWriter pw);
+
void userSwitched();
}
- // Thermal event received from vendor thermal management subsystem
- private final class ThermalEventListener extends IThermalEventListener.Stub {
+ // Thermal event received from thermal service manager subsystem
+ @VisibleForTesting
+ final class ThermalEventSkinListener extends IThermalEventListener.Stub {
@Override public void notifyThrottling(Temperature temp) {
- mHandler.post(mUpdateTempCallback);
+ int status = temp.getStatus();
+
+ if (status >= Temperature.THROTTLING_EMERGENCY) {
+ StatusBar statusBar = getComponent(StatusBar.class);
+ if (statusBar != null && !statusBar.isDeviceInVrMode()) {
+ mWarnings.showHighTemperatureWarning();
+ Slog.d(TAG, "ThermalEventSkinListener: notifyThrottling was called "
+ + ", current skin status = " + status
+ + ", temperature = " + temp.getValue());
+ }
+ } else {
+ mWarnings.dismissHighTemperatureWarning();
+ }
+ }
+ }
+
+ // Thermal event received from thermal service manager subsystem
+ @VisibleForTesting
+ final class ThermalEventUsbListener extends IThermalEventListener.Stub {
+ @Override public void notifyThrottling(Temperature temp) {
+ int status = temp.getStatus();
+
+ if (status >= Temperature.THROTTLING_EMERGENCY) {
+ mWarnings.showUsbHighTemperatureAlarm();
+ Slog.d(TAG, "ThermalEventUsbListener: notifyThrottling was called "
+ + ", current usb port status = " + status
+ + ", temperature = " + temp.getValue());
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java
index cf3f89e..409d60f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java
@@ -135,7 +135,7 @@
final Bitmap hardBitmap = SurfaceControl
.screenshot(new Rect(), mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels,
mNavigationBarView.getContext().getDisplay().getRotation());
- if (cropRect.bottom <= hardBitmap.getHeight()
+ if (hardBitmap != null && cropRect.bottom <= hardBitmap.getHeight()
&& cropRect.left + cropRect.width() <= hardBitmap.getWidth()) {
final Bitmap cropBitmap = Bitmap.createBitmap(hardBitmap, cropRect.left, cropRect.top,
cropRect.width(), cropRect.height());
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarEdgePanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarEdgePanel.java
index 64209a7..fcf5893 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarEdgePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarEdgePanel.java
@@ -103,7 +103,7 @@
public static NavigationBarEdgePanel create(@NonNull Context context, int width, int height,
int gravity) {
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(width, height,
- WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
+ WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
diff --git a/packages/SystemUI/src/com/android/systemui/volume/Events.java b/packages/SystemUI/src/com/android/systemui/volume/Events.java
index ca55e1f..1596ddb 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/Events.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/Events.java
@@ -53,6 +53,8 @@
public static final int EVENT_TOUCH_LEVEL_DONE = 16; // (stream|int) (level|bool)
public static final int EVENT_ZEN_CONFIG_CHANGED = 17; // (allow/disallow|string)
public static final int EVENT_RINGER_TOGGLE = 18; // (ringer_mode)
+ public static final int EVENT_SHOW_USB_OVERHEAT_ALARM = 19; // (reason|int) (keyguard|bool)
+ public static final int EVENT_DISMISS_USB_OVERHEAT_ALARM = 20; // (reason|int) (keyguard|bool)
private static final String[] EVENT_TAGS = {
"show_dialog",
@@ -73,7 +75,9 @@
"mute_changed",
"touch_level_done",
"zen_mode_config_changed",
- "ringer_toggle"
+ "ringer_toggle",
+ "show_usb_overheat_alarm",
+ "dismiss_usb_overheat_alarm"
};
public static final int DISMISS_REASON_UNKNOWN = 0;
@@ -85,6 +89,7 @@
public static final int DISMISS_REASON_DONE_CLICKED = 6;
public static final int DISMISS_STREAM_GONE = 7;
public static final int DISMISS_REASON_OUTPUT_CHOOSER = 8;
+ public static final int DISMISS_REASON_USB_OVERHEAD_ALARM_CHANGED = 9;
public static final String[] DISMISS_REASONS = {
"unknown",
"touch_outside",
@@ -94,16 +99,19 @@
"settings_clicked",
"done_clicked",
"a11y_stream_changed",
- "output_chooser"
+ "output_chooser",
+ "usb_temperature_below_threshold"
};
public static final int SHOW_REASON_UNKNOWN = 0;
public static final int SHOW_REASON_VOLUME_CHANGED = 1;
public static final int SHOW_REASON_REMOTE_VOLUME_CHANGED = 2;
+ public static final int SHOW_REASON_USB_OVERHEAD_ALARM_CHANGED = 3;
public static final String[] SHOW_REASONS = {
"unknown",
"volume_changed",
- "remote_volume_changed"
+ "remote_volume_changed",
+ "usb_temperature_above_threshold"
};
public static final int ICON_STATE_UNKNOWN = 0;
@@ -181,6 +189,19 @@
case EVENT_SUPPRESSOR_CHANGED:
sb.append(list[0]).append(' ').append(list[1]);
break;
+ case EVENT_SHOW_USB_OVERHEAT_ALARM:
+ MetricsLogger.visible(context, MetricsEvent.POWER_OVERHEAT_ALARM);
+ MetricsLogger.histogram(context, "show_usb_overheat_alarm",
+ (Boolean) list[1] ? 1 : 0);
+ sb.append(SHOW_REASONS[(Integer) list[0]]).append(" keyguard=").append(list[1]);
+ break;
+ case EVENT_DISMISS_USB_OVERHEAT_ALARM:
+ MetricsLogger.hidden(context, MetricsEvent.POWER_OVERHEAT_ALARM);
+ MetricsLogger.histogram(context, "dismiss_usb_overheat_alarm",
+ (Boolean) list[1] ? 1 : 0);
+ sb.append(DISMISS_REASONS[(Integer) list[0]])
+ .append(" keyguard=").append(list[1]);
+ break;
default:
sb.append(Arrays.asList(list));
break;
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index c903ab5..617b191 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -587,8 +587,11 @@
mHandler.removeMessages(H.DISMISS);
mHandler.removeMessages(H.SHOW);
mDialogView.animate().cancel();
- mShowing = false;
-
+ if (mShowing) {
+ mShowing = false;
+ // Only logs when the volume dialog visibility is changed.
+ Events.writeEvent(mContext, Events.EVENT_DISMISS_DIALOG, reason);
+ }
mDialogView.setTranslationX(0);
mDialogView.setAlpha(1);
ViewPropertyAnimator animator = mDialogView.animate()
@@ -601,8 +604,6 @@
}, 50));
if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2);
animator.start();
-
- Events.writeEvent(mContext, Events.EVENT_DISMISS_DIALOG, reason);
mController.notifyVisible(false);
synchronized (mSafetyWarningLock) {
if (mSafetyWarning != null) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java b/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
index bf6cc53..cd500b4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerNotificationWarningsTest.java
@@ -16,9 +16,8 @@
package com.android.systemui.power;
-import static android.test.MoreAsserts.assertNotEqual;
+import static com.google.common.truth.Truth.assertThat;
-import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
@@ -38,7 +37,6 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.util.NotificationChannels;
-import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -151,4 +149,13 @@
verify(mMockNotificationManager, times(1)).cancelAsUser(anyString(),
eq(SystemMessage.NOTE_THERMAL_SHUTDOWN), any());
}
+
+ @Test
+ public void testShowUsbHighTemperatureAlarm() {
+ mPowerNotificationWarnings.showUsbHighTemperatureAlarm();
+ waitForIdleSync(mContext.getMainThreadHandler());
+ assertThat(mPowerNotificationWarnings.mUsbHighTempDialog).isNotNull();
+
+ mPowerNotificationWarnings.mUsbHighTempDialog.dismiss();
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
index c28e74e..4a4e247 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java
@@ -14,14 +14,14 @@
package com.android.systemui.power;
-import static android.os.HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN;
-import static android.os.HardwarePropertiesManager.TEMPERATURE_CURRENT;
-import static android.os.HardwarePropertiesManager.TEMPERATURE_SHUTDOWN;
import static android.provider.Settings.Global.SHOW_TEMPERATURE_WARNING;
+import static android.provider.Settings.Global.SHOW_USB_TEMPERATURE_ALARM;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.anyObject;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
@@ -32,8 +32,10 @@
import android.content.Intent;
import android.os.BatteryManager;
import android.os.HardwarePropertiesManager;
+import android.os.IThermalEventListener;
import android.os.IThermalService;
import android.os.PowerManager;
+import android.os.Temperature;
import android.provider.Settings;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
@@ -80,6 +82,8 @@
private EnhancedEstimates mEnhancedEstimates;
@Mock private PowerManager mPowerManager;
@Mock private IThermalService mThermalServiceMock;
+ private IThermalEventListener mThermalEventUsbListener;
+ private IThermalEventListener mThermalEventSkinListener;
@Before
public void setup() {
@@ -93,78 +97,86 @@
mContext.addMockSystemService(Context.POWER_SERVICE, mPowerManager);
createPowerUi();
+ mThermalEventSkinListener = mPowerUI.new ThermalEventSkinListener();
+ mThermalEventUsbListener = mPowerUI.new ThermalEventUsbListener();
}
@Test
- public void testNoConfig_NoWarnings() {
- setOverThreshold();
- Settings.Global.putString(mContext.getContentResolver(), SHOW_TEMPERATURE_WARNING, null);
- TestableResources resources = mContext.getOrCreateTestableResources();
- resources.addOverride(R.integer.config_showTemperatureWarning, 0);
- resources.addOverride(R.integer.config_warningTemperature, 55);
-
+ public void testSkinWarning_throttlingCritical() throws Exception {
mPowerUI.start();
- verify(mMockWarnings, never()).showHighTemperatureWarning();
- }
- @Test
- public void testConfig_NoWarnings() {
- setUnderThreshold();
- Settings.Global.putString(mContext.getContentResolver(), SHOW_TEMPERATURE_WARNING, null);
- TestableResources resources = mContext.getOrCreateTestableResources();
- resources.addOverride(R.integer.config_showTemperatureWarning, 1);
- resources.addOverride(R.integer.config_warningTemperature, 55);
+ final Temperature temp = getCriticalStatusTemp(Temperature.TYPE_SKIN, "skin1");
+ mThermalEventSkinListener.notifyThrottling(temp);
- mPowerUI.start();
- verify(mMockWarnings, never()).showHighTemperatureWarning();
- }
-
- @Test
- public void testConfig_Warnings() {
- setOverThreshold();
- Settings.Global.putString(mContext.getContentResolver(), SHOW_TEMPERATURE_WARNING, null);
- TestableResources resources = mContext.getOrCreateTestableResources();
- resources.addOverride(R.integer.config_showTemperatureWarning, 1);
- resources.addOverride(R.integer.config_warningTemperature, 55);
-
- mPowerUI.start();
- // Guarantees mHandler has processed all messages.
+ // dismiss skin high temperature warning when throttling status is critical
TestableLooper.get(this).processAllMessages();
- verify(mMockWarnings).showHighTemperatureWarning();
+ verify(mMockWarnings, never()).showHighTemperatureWarning();
+ verify(mMockWarnings, times(1)).dismissHighTemperatureWarning();
}
@Test
- public void testSettingOverrideConfig() {
- setOverThreshold();
+ public void testSkinWarning_throttlingEmergency() throws Exception {
+ mPowerUI.start();
+
+ final Temperature temp = getEmergencyStatusTemp(Temperature.TYPE_SKIN, "skin2");
+ mThermalEventSkinListener.notifyThrottling(temp);
+
+ // show skin high temperature warning when throttling status is emergency
+ TestableLooper.get(this).processAllMessages();
+ verify(mMockWarnings, times(1)).showHighTemperatureWarning();
+ verify(mMockWarnings, never()).dismissHighTemperatureWarning();
+ }
+
+ @Test
+ public void testUsbAlarm_throttlingCritical() throws Exception {
+ mPowerUI.start();
+
+ final Temperature temp = getCriticalStatusTemp(Temperature.TYPE_USB_PORT, "usb1");
+ mThermalEventUsbListener.notifyThrottling(temp);
+
+ // not show usb high temperature alarm when throttling status is critical
+ TestableLooper.get(this).processAllMessages();
+ verify(mMockWarnings, never()).showUsbHighTemperatureAlarm();
+ }
+
+ @Test
+ public void testUsbAlarm_throttlingEmergency() throws Exception {
+ mPowerUI.start();
+
+ final Temperature temp = getEmergencyStatusTemp(Temperature.TYPE_USB_PORT, "usb2");
+ mThermalEventUsbListener.notifyThrottling(temp);
+
+ // show usb high temperature alarm when throttling status is emergency
+ TestableLooper.get(this).processAllMessages();
+ verify(mMockWarnings, times(1)).showUsbHighTemperatureAlarm();
+ }
+
+ @Test
+ public void testSettingOverrideConfig_enableSkinTemperatureWarning() throws Exception {
Settings.Global.putInt(mContext.getContentResolver(), SHOW_TEMPERATURE_WARNING, 1);
TestableResources resources = mContext.getOrCreateTestableResources();
resources.addOverride(R.integer.config_showTemperatureWarning, 0);
- resources.addOverride(R.integer.config_warningTemperature, 55);
mPowerUI.start();
- // Guarantees mHandler has processed all messages.
+ mPowerUI.registerThermalEventListener();
+
TestableLooper.get(this).processAllMessages();
- verify(mMockWarnings).showHighTemperatureWarning();
+ verify(mThermalServiceMock, times(1))
+ .registerThermalEventListenerWithType(anyObject(), eq(Temperature.TYPE_SKIN));
}
@Test
- public void testShutdownBasedThreshold() {
- int tolerance = 2;
- Settings.Global.putString(mContext.getContentResolver(), SHOW_TEMPERATURE_WARNING, null);
+ public void testSettingOverrideConfig_enableUsbTemperatureAlarm() throws Exception {
+ Settings.Global.putInt(mContext.getContentResolver(), SHOW_USB_TEMPERATURE_ALARM, 1);
TestableResources resources = mContext.getOrCreateTestableResources();
- resources.addOverride(R.integer.config_showTemperatureWarning, 1);
- resources.addOverride(R.integer.config_warningTemperature, -1);
- resources.addOverride(R.integer.config_warningTemperatureTolerance, tolerance);
- when(mHardProps.getDeviceTemperatures(DEVICE_TEMPERATURE_SKIN, TEMPERATURE_SHUTDOWN))
- .thenReturn(new float[] { 55 + tolerance });
+ resources.addOverride(R.integer.config_showUsbPortAlarm, 0);
- setCurrentTemp(54); // Below threshold.
mPowerUI.start();
- verify(mMockWarnings, never()).showHighTemperatureWarning();
+ mPowerUI.registerThermalEventListener();
- setCurrentTemp(56); // Above threshold.
- mPowerUI.updateTemperatureWarning();
- verify(mMockWarnings).showHighTemperatureWarning();
+ TestableLooper.get(this).processAllMessages();
+ verify(mThermalServiceMock, times(1))
+ .registerThermalEventListenerWithType(anyObject(), eq(Temperature.TYPE_USB_PORT));
}
@Test
@@ -532,17 +544,14 @@
verify(mEnhancedEstimates, times(2)).getEstimate();
}
- private void setCurrentTemp(float temp) {
- when(mHardProps.getDeviceTemperatures(DEVICE_TEMPERATURE_SKIN, TEMPERATURE_CURRENT))
- .thenReturn(new float[] { temp });
+ private Temperature getEmergencyStatusTemp(int type, String name) {
+ final float value = 65;
+ return new Temperature(value, type, name, Temperature.THROTTLING_EMERGENCY);
}
- private void setOverThreshold() {
- setCurrentTemp(50000);
- }
-
- private void setUnderThreshold() {
- setCurrentTemp(5);
+ private Temperature getCriticalStatusTemp(int type, String name) {
+ final float value = 60;
+ return new Temperature(value, type, name, Temperature.THROTTLING_CRITICAL);
}
private void createPowerUi() {
diff --git a/proto/src/metrics_constants/metrics_constants.proto b/proto/src/metrics_constants/metrics_constants.proto
index 530d115..4584306 100644
--- a/proto/src/metrics_constants/metrics_constants.proto
+++ b/proto/src/metrics_constants/metrics_constants.proto
@@ -6162,6 +6162,11 @@
// OS: P
FIELD_AUTOFILL_SESSION_ID = 1456;
+ // FIELD: Device USB overheat alarm trigger.
+ // CATEGORY: GLOBAL_SYSTEM_UI
+ // OS: P
+ POWER_OVERHEAT_ALARM = 1457;
+
// ---- End P Constants, all P constants go above this line ----
// Time since this notification last interrupted (visibly or audible) the user
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index ad0ed8b..ee3777d 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -1424,6 +1424,9 @@
// Amount of time wifi is scanning (ms)
optional int64 scan_time_ms = 12;
+
+ // Actual monitored rail energy consumed by wifi (mAh)
+ optional double monitored_rail_energy_consumed_mah = 13;
}
// Metrics for Wifi Wake
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index e0fb337..1cca813 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -30,6 +30,7 @@
import android.annotation.UserIdInt;
import android.app.ActivityManagerInternal;
import android.app.ActivityThread;
+import android.content.AutofillOptions;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -699,12 +700,31 @@
}
@Override
- public boolean isCompatibilityModeRequested(@NonNull String packageName,
+ public AutofillOptions getAutofillOptions(@NonNull String packageName,
long versionCode, @UserIdInt int userId) {
- return mAutofillCompatState.isCompatibilityModeRequested(
+ final int loggingLevel;
+ if (verbose) {
+ loggingLevel = AutofillManager.FLAG_ADD_CLIENT_VERBOSE
+ | AutofillManager.FLAG_ADD_CLIENT_DEBUG;
+ } else if (debug) {
+ loggingLevel = AutofillManager.FLAG_ADD_CLIENT_DEBUG;
+ } else {
+ loggingLevel = AutofillManager.NO_LOGGING;
+ }
+ final boolean compatModeEnabled = mAutofillCompatState.isCompatibilityModeRequested(
packageName, versionCode, userId);
- }
+ final AutofillOptions options = new AutofillOptions(loggingLevel, compatModeEnabled);
+ synchronized (mLock) {
+ final AutofillManagerServiceImpl service =
+ getServiceForUserLocked(UserHandle.getCallingUserId());
+ if (service != null) {
+ service.setAugmentedAutofillWhitelistLocked(options, packageName);
+ }
+ }
+
+ return options;
+ }
}
/**
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 15dce4a..364e537 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -28,6 +28,7 @@
import android.app.ActivityManagerInternal;
import android.app.ActivityTaskManager;
import android.app.IActivityTaskManager;
+import android.content.AutofillOptions;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -1169,6 +1170,13 @@
return mWhitelistedAugmentAutofillPackages.contains(packageName);
}
+ @GuardedBy("mLock")
+ void setAugmentedAutofillWhitelistLocked(@NonNull AutofillOptions options,
+ @NonNull String packageName) {
+ // TODO(b/122595322): need to setwhitelisted activities as well.
+ options.augmentedEnabled = mWhitelistedAugmentAutofillPackages.contains(packageName);
+ }
+
private void whitelistForAugmentedAutofillPackages(@NonNull List<String> packages) {
// TODO(b/123100824): add CTS test for when it's null
synchronized (mLock) {
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 0dd1ded..ffda581 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -464,15 +464,25 @@
*/
@Nullable
public UserHandle getUserForAncestralSerialNumber(long ancestralSerialNumber) {
- for (UserHandle handle : mContext.getSystemService(UserManager.class).getUserProfiles()) {
- UserBackupManagerService userBackupManagerService = getServiceUsers().get(
- handle.getIdentifier());
+ int callingUserId = Binder.getCallingUserHandle().getIdentifier();
+ long oldId = Binder.clearCallingIdentity();
+ int[] userIds;
+ try {
+ userIds = mContext.getSystemService(UserManager.class).getProfileIds(callingUserId,
+ false);
+ } finally {
+ Binder.restoreCallingIdentity(oldId);
+ }
+
+ for (int userId : userIds) {
+ UserBackupManagerService userBackupManagerService = getServiceUsers().get(userId);
if (userBackupManagerService != null) {
if (userBackupManagerService.getAncestralSerialNumber() == ancestralSerialNumber) {
- return handle;
+ return UserHandle.of(userId);
}
}
}
+
return null;
}
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index 0ed5beb..4d39f9a 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -145,7 +145,7 @@
# ---------------------------
# SystemServer.run() starts:
3010 boot_progress_system_run (time|2|3)
-
+3011 system_server_start (start_count|1),(uptime|2|3),(elapse_time|2|3)
# ---------------------------
# PackageManagerService.java
diff --git a/services/core/java/com/android/server/LooperStatsService.java b/services/core/java/com/android/server/LooperStatsService.java
index c334540..b423f62 100644
--- a/services/core/java/com/android/server/LooperStatsService.java
+++ b/services/core/java/com/android/server/LooperStatsService.java
@@ -54,7 +54,7 @@
private static final String SETTINGS_TRACK_SCREEN_INTERACTIVE_KEY = "track_screen_state";
private static final String DEBUG_SYS_LOOPER_STATS_ENABLED =
"debug.sys.looper_stats_enabled";
- private static final int DEFAULT_SAMPLING_INTERVAL = 100;
+ private static final int DEFAULT_SAMPLING_INTERVAL = 1000;
private static final int DEFAULT_ENTRIES_SIZE_CAP = 2000;
private static final boolean DEFAULT_ENABLED = true;
private static final boolean DEFAULT_TRACK_SCREEN_INTERACTIVE = false;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 7c46f1d..375c5c4 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -187,6 +187,7 @@
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManagerInternal;
import android.appwidget.AppWidgetManager;
+import android.content.AutofillOptions;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
import android.content.ComponentName;
@@ -1486,6 +1487,8 @@
private static String sTheRealBuildSerial = Build.UNKNOWN;
+ private ParcelFileDescriptor[] mLifeMonitorFds;
+
final class UiHandler extends Handler {
public UiHandler() {
super(com.android.server.UiThread.get().getLooper(), null, true);
@@ -4741,12 +4744,12 @@
// Figure out whether the app needs to run in autofill compat mode.
- boolean isAutofillCompatEnabled = false;
+ AutofillOptions autofillOptions = null;
if (UserHandle.getAppId(app.info.uid) >= Process.FIRST_APPLICATION_UID) {
final AutofillManagerInternal afm = LocalServices.getService(
AutofillManagerInternal.class);
if (afm != null) {
- isAutofillCompatEnabled = afm.isCompatibilityModeRequested(
+ autofillOptions = afm.getAutofillOptions(
app.info.packageName, app.info.versionCode, app.userId);
}
}
@@ -4779,7 +4782,7 @@
new Configuration(app.getWindowProcessController().getConfiguration()),
app.compat, getCommonServicesLocked(app.isolated),
mCoreSettingsObserver.getCoreSettingsLocked(),
- buildSerial, isAutofillCompatEnabled, contentCaptureOptions);
+ buildSerial, autofillOptions, contentCaptureOptions);
} else {
thread.bindApplication(processName, appInfo, providers, null, profilerInfo,
null, null, null, testMode,
@@ -4788,7 +4791,7 @@
new Configuration(app.getWindowProcessController().getConfiguration()),
app.compat, getCommonServicesLocked(app.isolated),
mCoreSettingsObserver.getCoreSettingsLocked(),
- buildSerial, isAutofillCompatEnabled, contentCaptureOptions);
+ buildSerial, autofillOptions, contentCaptureOptions);
}
if (profilerInfo != null) {
profilerInfo.closeFd();
@@ -18500,4 +18503,24 @@
private boolean isOnOffloadQueue(int flags) {
return (mEnableOffloadQueue && ((flags & Intent.FLAG_RECEIVER_OFFLOAD) != 0));
}
+
+ @Override
+ public ParcelFileDescriptor getLifeMonitor() {
+ if (!isCallerShell()) {
+ throw new SecurityException("Only shell can call it");
+ }
+ synchronized (this) {
+ try {
+ if (mLifeMonitorFds == null) {
+ mLifeMonitorFds = ParcelFileDescriptor.createPipe();
+ }
+ // The returned FD will be closed, but we want to keep our reader open,
+ // so return a dup instead.
+ return mLifeMonitorFds[0].dup();
+ } catch (IOException e) {
+ Slog.w(TAG, "Unable to create pipe", e);
+ return null;
+ }
+ }
+ }
}
diff --git a/services/core/java/com/android/server/content/SyncManager.java b/services/core/java/com/android/server/content/SyncManager.java
index 99e0707..8a208a5 100644
--- a/services/core/java/com/android/server/content/SyncManager.java
+++ b/services/core/java/com/android/server/content/SyncManager.java
@@ -916,15 +916,17 @@
extras = new Bundle();
}
extras.size(); // Force unpacel.
- mLogger.log("scheduleSync: account=", requestedAccount,
- " u", userId,
- " authority=", requestedAuthority,
- " reason=", reason,
- " extras=", extras,
- " cuid=", callingUid, " cpid=", callingPid, " cpkg=", callingPackage,
- " mdm=", minDelayMillis,
- " ciar=", checkIfAccountReady,
- " sef=", syncExemptionFlag);
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ mLogger.log("scheduleSync: account=", requestedAccount,
+ " u", userId,
+ " authority=", requestedAuthority,
+ " reason=", reason,
+ " extras=", extras,
+ " cuid=", callingUid, " cpid=", callingPid, " cpkg=", callingPackage,
+ " mdm=", minDelayMillis,
+ " ciar=", checkIfAccountReady,
+ " sef=", syncExemptionFlag);
+ }
AccountAndUser[] accounts = null;
if (requestedAccount != null) {
diff --git a/services/core/java/com/android/server/display/ColorFade.java b/services/core/java/com/android/server/display/ColorFade.java
index 31b497d..36d9c0e 100644
--- a/services/core/java/com/android/server/display/ColorFade.java
+++ b/services/core/java/com/android/server/display/ColorFade.java
@@ -582,7 +582,7 @@
final SurfaceControl.Builder builder =
new SurfaceControl.Builder(mSurfaceSession).setName("ColorFade");
if (mMode == MODE_FADE) {
- builder.setColorLayer(true);
+ builder.setColorLayer();
} else {
builder.setBufferSize(mDisplayWidth, mDisplayHeight);
}
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index b2509e9..b020997 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -1482,7 +1482,7 @@
pw.println(" mSingleDisplayDemoMode=" + mSingleDisplayDemoMode);
pw.println(" mWifiDisplayScanRequestCount=" + mWifiDisplayScanRequestCount);
pw.println(" mStableDisplaySize=" + mStableDisplaySize);
-
+ pw.println(" mMinimumBrightnessCurve=" + mMinimumBrightnessCurve);
IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ");
ipw.increaseIndent();
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 9ff2f44..07d460e 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -13058,6 +13058,7 @@
@Override
public String[] getUnsuspendablePackagesForUser(String[] packageNames, int userId) {
+ Preconditions.checkNotNull("packageNames cannot be null", packageNames);
mContext.enforceCallingOrSelfPermission(Manifest.permission.SUSPEND_APPS,
"getUnsuspendablePackagesForUser");
final int callingUid = Binder.getCallingUid();
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index d0f192d..3744f68 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -1324,6 +1324,7 @@
@Override
public ParcelFileDescriptor getUserIcon(int targetUserId) {
+ checkManageUsersPermission("get user icon");
String iconPath;
synchronized (mPackagesLock) {
UserInfo targetUserInfo = getUserInfoNoChecks(targetUserId);
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 6369179..93a3d0a 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -206,6 +206,11 @@
// STOPSHIP(b/112545973): remove once feature enabled by default
if (StorageManager.hasIsolatedStorage()) {
MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_AUDIO);
+
+ // STOPSHIP(b/124466734): remove these manual grants once the legacy
+ // permission logic is unified with PermissionController
+ MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
+ MEDIA_AURAL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
}
@@ -215,6 +220,11 @@
if (StorageManager.hasIsolatedStorage()) {
MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_VIDEO);
MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_MEDIA_IMAGES);
+
+ // STOPSHIP(b/124466734): remove these manual grants once the legacy
+ // permission logic is unified with PermissionController
+ MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.READ_EXTERNAL_STORAGE);
+ MEDIA_VISUAL_PERMISSIONS.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
}
}
@@ -642,16 +652,10 @@
// Location
if (locationPackageNames != null) {
for (String packageName : locationPackageNames) {
- // STOPSHIP: remove this force-granting of legacy storage
- // permissions once b/124466734 is resolved
- final Set<String> storageWorkaround = new ArraySet<>();
- storageWorkaround.add(Manifest.permission.READ_EXTERNAL_STORAGE);
- storageWorkaround.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
-
grantPermissionsToSystemPackage(packageName, userId,
CONTACTS_PERMISSIONS, CALENDAR_PERMISSIONS, MICROPHONE_PERMISSIONS,
PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS,
- SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, storageWorkaround);
+ SENSORS_PERMISSIONS, STORAGE_PERMISSIONS, MEDIA_AURAL_PERMISSIONS);
grantSystemFixedPermissionsToSystemPackage(packageName, userId,
LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS);
}
diff --git a/services/core/java/com/android/server/policy/role/LegacyRoleResolutionPolicy.java b/services/core/java/com/android/server/policy/role/LegacyRoleResolutionPolicy.java
index 888dd99..77bf930 100644
--- a/services/core/java/com/android/server/policy/role/LegacyRoleResolutionPolicy.java
+++ b/services/core/java/com/android/server/policy/role/LegacyRoleResolutionPolicy.java
@@ -130,6 +130,12 @@
String packageName = componentName != null ? componentName.getPackageName() : null;
return CollectionUtils.singletonOrEmpty(packageName);
}
+ case RoleManager.ROLE_EMERGENCY: {
+ String defaultEmergencyApp = Settings.Secure.getStringForUser(
+ mContext.getContentResolver(),
+ Settings.Secure.EMERGENCY_ASSISTANCE_APPLICATION, userId);
+ return CollectionUtils.singletonOrEmpty(defaultEmergencyApp);
+ }
default: {
Slog.e(LOG_TAG, "Don't know how to find legacy role holders for " + roleName);
return Collections.emptyList();
diff --git a/services/core/java/com/android/server/role/RoleManagerService.java b/services/core/java/com/android/server/role/RoleManagerService.java
index c145a22..17d3066 100644
--- a/services/core/java/com/android/server/role/RoleManagerService.java
+++ b/services/core/java/com/android/server/role/RoleManagerService.java
@@ -237,6 +237,7 @@
migrateRoleIfNecessary(RoleManager.ROLE_SMS, userId);
migrateRoleIfNecessary(RoleManager.ROLE_ASSISTANT, userId);
migrateRoleIfNecessary(RoleManager.ROLE_DIALER, userId);
+ migrateRoleIfNecessary(RoleManager.ROLE_EMERGENCY, userId);
// Some vital packages state has changed since last role grant
// Run grants again
diff --git a/services/core/java/com/android/server/role/TEST_MAPPING b/services/core/java/com/android/server/role/TEST_MAPPING
index 0b967be..0d7bc14 100644
--- a/services/core/java/com/android/server/role/TEST_MAPPING
+++ b/services/core/java/com/android/server/role/TEST_MAPPING
@@ -7,11 +7,14 @@
"include-filter": "android.cts.statsd.atom.UidAtomTests#testRoleHolder"
}
]
- }
- ],
- "postsubmit": [
+ },
{
- "name": "CtsRoleTestCases"
+ "name": "CtsRoleTestCases",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ }
+ ]
}
]
}
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 9ea819e..9f04166 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -46,6 +46,7 @@
import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
+import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.ActivityInfo.DOCUMENT_LAUNCH_ALWAYS;
import static android.content.pm.ActivityInfo.LAUNCH_MULTIPLE;
import static android.content.pm.ActivityInfo.LAUNCH_SINGLE_INSTANCE;
@@ -1457,6 +1458,14 @@
// This task was started because of movement of the activity based on affinity...
// Now that we are actually launching it, we can assign the base intent.
reusedActivity.getTaskRecord().setIntent(mStartActivity);
+ } else {
+ final boolean taskOnHome =
+ (mStartActivity.intent.getFlags() & FLAG_ACTIVITY_TASK_ON_HOME) != 0;
+ if (taskOnHome) {
+ reusedActivity.getTaskRecord().intent.addFlags(FLAG_ACTIVITY_TASK_ON_HOME);
+ } else {
+ reusedActivity.getTaskRecord().intent.removeFlags(FLAG_ACTIVITY_TASK_ON_HOME);
+ }
}
// This code path leads to delivering a new intent, we want to make sure we schedule it
diff --git a/services/core/java/com/android/server/wm/BlackFrame.java b/services/core/java/com/android/server/wm/BlackFrame.java
index 497e412..84ba5ca9 100644
--- a/services/core/java/com/android/server/wm/BlackFrame.java
+++ b/services/core/java/com/android/server/wm/BlackFrame.java
@@ -48,7 +48,7 @@
surface = dc.makeOverlay()
.setName("BlackSurface")
- .setColorLayer(true)
+ .setColorLayer()
.setParent(null) // TODO: Work-around for b/69259549
.build();
transaction.setWindowCrop(surface, w, h);
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index 1373e18..ee28084 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -164,7 +164,7 @@
private SurfaceControl makeDimLayer() {
return mHost.makeChildSurface(null)
.setParent(mHost.getSurfaceControl())
- .setColorLayer(true)
+ .setColorLayer()
.setName("Dim Layer for - " + mHost.getName())
.build();
}
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index a19721f..ae76740 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -899,7 +899,9 @@
mDividerControllerLocked = new DockedStackDividerController(service, this);
mPinnedStackControllerLocked = new PinnedStackController(service, this);
- final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession).setOpaque(true);
+ final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
+ .setOpaque(true)
+ .setContainerLayer();
mWindowingLayer = b.setName("Display Root").build();
mOverlayLayer = b.setName("Display Overlays").build();
@@ -4647,7 +4649,7 @@
@Override
SurfaceControl.Builder makeChildSurface(WindowContainer child) {
SurfaceSession s = child != null ? child.getSession() : getSession();
- final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s);
+ final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s).setContainerLayer();
if (child == null) {
return b;
}
diff --git a/services/core/java/com/android/server/wm/DragState.java b/services/core/java/com/android/server/wm/DragState.java
index 3f77e1c..2b2231a 100644
--- a/services/core/java/com/android/server/wm/DragState.java
+++ b/services/core/java/com/android/server/wm/DragState.java
@@ -164,7 +164,7 @@
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId)
- .getSession()).setContainerLayer(true)
+ .getSession()).setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
}
final InputWindowHandle h = getInputWindowHandle();
diff --git a/services/core/java/com/android/server/wm/InputConsumerImpl.java b/services/core/java/com/android/server/wm/InputConsumerImpl.java
index 4df5a0b..ab95e4b 100644
--- a/services/core/java/com/android/server/wm/InputConsumerImpl.java
+++ b/services/core/java/com/android/server/wm/InputConsumerImpl.java
@@ -22,13 +22,11 @@
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
-import android.view.InputChannel;
-import android.view.WindowManager;
-
import android.view.InputApplicationHandle;
+import android.view.InputChannel;
import android.view.InputWindowHandle;
import android.view.SurfaceControl;
-import android.util.Slog;
+import android.view.WindowManager;
import java.io.PrintWriter;
@@ -89,7 +87,7 @@
mWindowHandle.scaleFactor = 1.0f;
mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId)
- .getSession()).setContainerLayer(true).setName("Input Consumer " + name)
+ .getSession()).setContainerLayer().setName("Input Consumer " + name)
.build();
}
diff --git a/services/core/java/com/android/server/wm/Letterbox.java b/services/core/java/com/android/server/wm/Letterbox.java
index d67193e..f8f693c 100644
--- a/services/core/java/com/android/server/wm/Letterbox.java
+++ b/services/core/java/com/android/server/wm/Letterbox.java
@@ -233,7 +233,7 @@
private void createSurface() {
mSurface = mFactory.get().setName("Letterbox - " + mType)
- .setFlags(HIDDEN).setColorLayer(true).build();
+ .setFlags(HIDDEN).setColorLayer().build();
mSurface.setLayer(-1);
mSurface.setColor(new float[]{0, 0, 0});
}
diff --git a/services/core/java/com/android/server/wm/TaskPositioningController.java b/services/core/java/com/android/server/wm/TaskPositioningController.java
index 9163165..cdcb857 100644
--- a/services/core/java/com/android/server/wm/TaskPositioningController.java
+++ b/services/core/java/com/android/server/wm/TaskPositioningController.java
@@ -83,7 +83,7 @@
final DisplayContent dc = mService.mRoot.getDisplayContent(displayId);
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(dc.getSession())
- .setContainerLayer(true)
+ .setContainerLayer()
.setName("Drag and Drop Input Consumer").build();
}
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
index 2d3e3ae..938c8b4 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java
@@ -61,12 +61,12 @@
import android.util.Slog;
import android.view.DisplayCutout;
import android.view.IWindowSession;
+import android.view.InsetsState;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
-import android.view.InsetsState;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index fc95789..241f14e 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -832,7 +832,7 @@
updateSurfaceBounds();
if (mAnimationBackgroundSurface == null) {
- mAnimationBackgroundSurface = makeChildSurface(null).setColorLayer(true)
+ mAnimationBackgroundSurface = makeChildSurface(null).setColorLayer()
.setName("animation background stackId=" + mStackId)
.build();
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 4700b96..8d88c5a 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -310,6 +310,7 @@
private boolean mOnlyCore;
private boolean mFirstBoot;
+ private final int mStartCount;
private final boolean mRuntimeRestart;
private final long mRuntimeStartElapsedTime;
private final long mRuntimeStartUptime;
@@ -317,6 +318,9 @@
private static final String START_SENSOR_SERVICE = "StartSensorService";
private static final String START_HIDL_SERVICES = "StartHidlServices";
+ private static final String SYSPROP_START_COUNT = "sys.system_server.start_count";
+ private static final String SYSPROP_START_ELAPSED = "sys.system_server.start_elapsed";
+ private static final String SYSPROP_START_UPTIME = "sys.system_server.start_uptime";
private Future<?> mSensorServiceStart;
private Future<?> mZygotePreload;
@@ -346,16 +350,33 @@
public SystemServer() {
// Check for factory test mode.
mFactoryTestMode = FactoryTest.getMode();
- // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot
- mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed"));
+ // Record process start information.
+ // Note SYSPROP_START_COUNT will increment by *2* on a FDE device when it fully boots;
+ // one for the password screen, second for the actual boot.
+ mStartCount = SystemProperties.getInt(SYSPROP_START_COUNT, 0) + 1;
mRuntimeStartElapsedTime = SystemClock.elapsedRealtime();
mRuntimeStartUptime = SystemClock.uptimeMillis();
+
+ // Remember if it's runtime restart(when sys.boot_completed is already set) or reboot
+ // We don't use "mStartCount > 1" here because it'll be wrong on a FDE device.
+ // TODO: mRuntimeRestart will *not* be set to true if the proccess crashes before
+ // sys.boot_completed is set. Fix it.
+ mRuntimeRestart = "1".equals(SystemProperties.get("sys.boot_completed"));
}
private void run() {
try {
traceBeginAndSlog("InitBeforeStartServices");
+
+ // Record the process start information in sys props.
+ SystemProperties.set(SYSPROP_START_COUNT, String.valueOf(mStartCount));
+ SystemProperties.set(SYSPROP_START_ELAPSED, String.valueOf(mRuntimeStartElapsedTime));
+ SystemProperties.set(SYSPROP_START_UPTIME, String.valueOf(mRuntimeStartUptime));
+
+ EventLog.writeEvent(EventLogTags.SYSTEM_SERVER_START,
+ mStartCount, mRuntimeStartUptime, mRuntimeStartElapsedTime);
+
// If a device's clock is before 1970 (before 0), a lot of
// APIs crash dealing with negative numbers, notably
// java.io.File#setLastModified, so instead we fake it and
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index a1aee6d..3dc1199 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -1569,6 +1569,17 @@
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public @TelephonyManager.NetworkType int getDataNetworkType() {
+ final NetworkRegistrationState iwlanRegState = getNetworkRegistrationState(
+ NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WLAN);
+ if (iwlanRegState != null
+ && iwlanRegState.getRegState() == NetworkRegistrationState.REG_STATE_HOME) {
+ // If the device is on IWLAN, return IWLAN as the network type. This is to simulate the
+ // behavior of legacy mode device. In the future caller should use
+ // getNetworkRegistrationState() to retrieve the actual data network type on cellular
+ // or on IWLAN.
+ return iwlanRegState.getAccessNetworkTechnology();
+ }
+
final NetworkRegistrationState regState = getNetworkRegistrationState(
NetworkRegistrationState.DOMAIN_PS, AccessNetworkConstants.TransportType.WWAN);
if (regState != null) {
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 94f26a8..c28d1fb 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2081,7 +2081,7 @@
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- subId = iSub.getActiveSubIdList();
+ subId = iSub.getActiveSubIdList(/*visibleOnly*/true);
}
} catch (RemoteException ex) {
// ignore it
@@ -2866,7 +2866,7 @@
*
* @hide
*/
- private boolean shouldHideSubscription(SubscriptionInfo info) {
+ public boolean shouldHideSubscription(SubscriptionInfo info) {
if (info == null) return false;
// If hasCarrierPrivileges or canManageSubscription returns true, it means caller
@@ -2874,8 +2874,14 @@
boolean hasCarrierPrivilegePermission = (info.isEmbedded() && canManageSubscription(info))
|| TelephonyManager.from(mContext).hasCarrierPrivileges(info.getSubscriptionId());
- return (!TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic()
- && !hasCarrierPrivilegePermission);
+ return isInvisibleSubscription(info) && !hasCarrierPrivilegePermission;
+ }
+
+ /**
+ * @hide
+ */
+ public static boolean isInvisibleSubscription(SubscriptionInfo info) {
+ return info != null && !TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic();
}
/**
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 0b72679..f1869b0 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -10306,24 +10306,25 @@
/**
* Returns if the usage of multiple SIM cards at the same time to register on the network
- * (e.g. Dual Standby or Dual Active) is restricted.
+ * (e.g. Dual Standby or Dual Active) is supported by the device and by the carrier.
*
- * @return true if usage of multiple SIMs is restricted, false otherwise.
+ * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
+ * or that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
*
- * @hide
+ * @return true if usage of multiple SIMs is supported, false otherwise.
*/
- @SystemApi
- @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- public boolean isMultisimCarrierRestricted() {
+ @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
+ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
+ public boolean isMultisimSupported() {
try {
ITelephony service = getITelephony();
if (service != null) {
- return service.isMultisimCarrierRestricted();
+ return service.isMultisimSupported(getOpPackageName());
}
} catch (RemoteException e) {
- Log.e(TAG, "isMultisimCarrierRestricted RemoteException", e);
+ Log.e(TAG, "isMultisimSupported RemoteException", e);
}
- return true;
+ return false;
}
/**
@@ -10338,8 +10339,8 @@
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void switchMultiSimConfig(int numOfSims) {
//only proceed if multi-sim is not restricted
- if (isMultisimCarrierRestricted()) {
- Rlog.e(TAG, "switchMultiSimConfig not possible. It is restricted.");
+ if (!isMultisimSupported()) {
+ Rlog.e(TAG, "switchMultiSimConfig not possible. It is restricted or not supported.");
return;
}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 75a4d82..79e0aa1 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -275,7 +275,7 @@
void clearDefaultsForInactiveSubIds();
- int[] getActiveSubIdList();
+ int[] getActiveSubIdList(boolean visibleOnly);
int setSubscriptionProperty(int subId, String propKey, String propValue);
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index c54a606..d183837 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -1834,10 +1834,12 @@
void setMultisimCarrierRestriction(boolean isMultisimCarrierRestricted);
/**
- * Returns if the usage of multiple SIM cards at the same time is restricted.
- * @hide
+ * Returns if the usage of multiple SIM cards at the same time is supported.
+ *
+ * @param callingPackage The package making the call.
+ * @return true if multisim is supported, false otherwise.
*/
- boolean isMultisimCarrierRestricted();
+ boolean isMultisimSupported(String callingPackage);
/**
* Switch configs to enable multi-sim or switch back to single-sim
diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
index 603c4c2..030c3f4 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
@@ -188,18 +188,17 @@
*/
static final String PROPERTY_IGNORE_NITZ = "telephony.test.ignore.nitz";
- /**
+ /**
* Property to set multi sim feature.
* Type: String(dsds, dsda)
*/
static final String PROPERTY_MULTI_SIM_CONFIG = "persist.radio.multisim.config";
- /**
+ /**
* Property to indicate if reboot is required when changing modems configurations
* Type: String(true, false) default is false; most devices don't need reboot
*/
- String PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE =
- "persist.radio.reboot_on_modem_change";
+ String PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE = "persist.radio.reboot_on_modem_change";
/**
* Property to store default subscription.
diff --git a/tools/validatekeymaps/Main.cpp b/tools/validatekeymaps/Main.cpp
index f31f771..56a242f 100644
--- a/tools/validatekeymaps/Main.cpp
+++ b/tools/validatekeymaps/Main.cpp
@@ -128,13 +128,11 @@
}
case FILETYPE_VIRTUALKEYDEFINITION: {
- VirtualKeyMap* map;
- status_t status = VirtualKeyMap::load(filename, &map);
- if (status) {
- error("Error %d parsing virtual key definition file.\n\n", status);
+ std::unique_ptr<VirtualKeyMap> map = VirtualKeyMap::load(filename);
+ if (!map) {
+ error("Error while parsing virtual key definition file.\n\n");
return false;
}
- delete map;
break;
}
}