Merge ""am dumpheap" is now synchronous."
diff --git a/api/current.txt b/api/current.txt
index 04a4941..1fe5bc7 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -20869,6 +20869,7 @@
field public static final android.icu.util.MeasureUnit PICOMETER;
field public static final android.icu.util.MeasureUnit PINT;
field public static final android.icu.util.MeasureUnit PINT_METRIC;
+ field public static final android.icu.util.MeasureUnit POINT;
field public static final android.icu.util.MeasureUnit POUND;
field public static final android.icu.util.MeasureUnit POUND_PER_SQUARE_INCH;
field public static final android.icu.util.MeasureUnit QUART;
@@ -24499,7 +24500,8 @@
public final class MediaTimestamp {
method public long getAnchorMediaTimeUs();
- method public long getAnchorSytemNanoTime();
+ method public long getAnchorSystemNanoTime();
+ method public deprecated long getAnchorSytemNanoTime();
method public float getMediaClockRate();
field public static final android.media.MediaTimestamp TIMESTAMP_UNKNOWN;
}
diff --git a/cmds/statsd/statsd.rc b/cmds/statsd/statsd.rc
index f349292..cbf2a8d 100644
--- a/cmds/statsd/statsd.rc
+++ b/cmds/statsd/statsd.rc
@@ -19,6 +19,9 @@
group statsd log
writepid /dev/cpuset/system-background/tasks
+on property:ro.statsd.enable=false
+ stop statsd
+
on post-fs-data
# Create directory for statsd
mkdir /data/misc/stats-data/ 0770 statsd system
diff --git a/config/generate-preloaded-classes.sh b/config/generate-preloaded-classes.sh
index e36e148..0ad3a02 100755
--- a/config/generate-preloaded-classes.sh
+++ b/config/generate-preloaded-classes.sh
@@ -36,4 +36,4 @@
extra_classes_files=("$@")
# Disable locale to enable lexicographical sorting
-LC_ALL=C sort "$input" "${extra_classes_files[@]}" | uniq | grep -f "$blacklist" -v -F -x
+LC_ALL=C sort "$input" "${extra_classes_files[@]}" | uniq | grep -f "$blacklist" -v -F -x | grep -v "\$NoPreloadHolder"
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index 090fc0f..ab6150f 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -170,6 +170,7 @@
Landroid/app/ActivityManagerNative;->isSystemReady()Z
Landroid/app/ActivityOptions;->makeCustomAnimation(Landroid/content/Context;IILandroid/os/Handler;Landroid/app/ActivityOptions$OnAnimationStartedListener;)Landroid/app/ActivityOptions;
Landroid/app/ActivityOptions;->makeMultiThumbFutureAspectScaleAnimation(Landroid/content/Context;Landroid/os/Handler;Landroid/view/IAppTransitionAnimationSpecsFuture;Landroid/app/ActivityOptions$OnAnimationStartedListener;Z)Landroid/app/ActivityOptions;
+Landroid/app/ActivityThread$ActivityClientRecord;-><init>()V
Landroid/app/ActivityThread$ActivityClientRecord;->activity:Landroid/app/Activity;
Landroid/app/ActivityThread$ActivityClientRecord;->activityInfo:Landroid/content/pm/ActivityInfo;
Landroid/app/ActivityThread$ActivityClientRecord;->compatInfo:Landroid/content/res/CompatibilityInfo;
@@ -179,6 +180,7 @@
Landroid/app/ActivityThread$ActivityClientRecord;->paused:Z
Landroid/app/ActivityThread$ActivityClientRecord;->stopped:Z
Landroid/app/ActivityThread$ActivityClientRecord;->token:Landroid/os/IBinder;
+Landroid/app/ActivityThread$AppBindData;-><init>()V
Landroid/app/ActivityThread$AppBindData;->appInfo:Landroid/content/pm/ApplicationInfo;
Landroid/app/ActivityThread$AppBindData;->compatInfo:Landroid/content/res/CompatibilityInfo;
Landroid/app/ActivityThread$AppBindData;->info:Landroid/app/LoadedApk;
@@ -500,6 +502,7 @@
Landroid/app/ContentProviderHolder;->info:Landroid/content/pm/ProviderInfo;
Landroid/app/ContentProviderHolder;->noReleaseNeeded:Z
Landroid/app/ContentProviderHolder;->provider:Landroid/content/IContentProvider;
+Landroid/app/ContextImpl$ApplicationContentResolver;->acquireProvider(Landroid/content/Context;Ljava/lang/String;)Landroid/content/IContentProvider;
Landroid/app/ContextImpl$ApplicationContentResolver;->mMainThread:Landroid/app/ActivityThread;
Landroid/app/ContextImpl;->createActivityContext(Landroid/app/ActivityThread;Landroid/app/LoadedApk;Landroid/content/pm/ActivityInfo;Landroid/os/IBinder;ILandroid/content/res/Configuration;)Landroid/app/ContextImpl;
Landroid/app/ContextImpl;->createAppContext(Landroid/app/ActivityThread;Landroid/app/LoadedApk;)Landroid/app/ContextImpl;
@@ -583,6 +586,7 @@
Landroid/app/IActivityManager$Stub$Proxy;->isAppForeground(I)Z
Landroid/app/IActivityManager$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Landroid/app/IActivityManager$Stub$Proxy;->setActivityController(Landroid/app/IActivityController;Z)V
+Landroid/app/IActivityManager$Stub$Proxy;->updatePersistentConfiguration(Landroid/content/res/Configuration;)V
Landroid/app/IActivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IActivityManager;
Landroid/app/IActivityManager;->bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I
Landroid/app/IActivityManager;->broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I
@@ -876,8 +880,10 @@
Landroid/app/ProgressDialog;->mProgressNumber:Landroid/widget/TextView;
Landroid/app/QueuedWork;->addFinisher(Ljava/lang/Runnable;)V
Landroid/app/QueuedWork;->getHandler()Landroid/os/Handler;
+Landroid/app/QueuedWork;->queue(Ljava/lang/Runnable;Z)V
Landroid/app/QueuedWork;->removeFinisher(Ljava/lang/Runnable;)V
Landroid/app/QueuedWork;->sFinishers:Ljava/util/LinkedList;
+Landroid/app/ResourcesManager$ActivityResources;-><init>()V
Landroid/app/ResourcesManager;-><init>()V
Landroid/app/ResourcesManager;->appendLibAssetForMainAssetPath(Ljava/lang/String;Ljava/lang/String;)V
Landroid/app/ResourcesManager;->createAssetManager(Landroid/content/res/ResourcesKey;)Landroid/content/res/AssetManager;
@@ -894,6 +900,7 @@
Landroid/app/SearchableInfo$ActionKeyInfo;->getQueryActionMsg()Ljava/lang/String;
Landroid/app/SearchableInfo$ActionKeyInfo;->getSuggestActionMsg()Ljava/lang/String;
Landroid/app/SearchableInfo$ActionKeyInfo;->getSuggestActionMsgColumn()Ljava/lang/String;
+Landroid/app/SearchableInfo;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;Landroid/content/ComponentName;)V
Landroid/app/SearchableInfo;->findActionKey(I)Landroid/app/SearchableInfo$ActionKeyInfo;
Landroid/app/SearchableInfo;->getActivityContext(Landroid/content/Context;)Landroid/content/Context;
Landroid/app/SearchableInfo;->getIconId()I
@@ -1344,6 +1351,7 @@
Landroid/content/Context;->startActivityAsUser(Landroid/content/Intent;Landroid/os/Bundle;Landroid/os/UserHandle;)V
Landroid/content/Context;->startActivityForResult(Ljava/lang/String;Landroid/content/Intent;ILandroid/os/Bundle;)V
Landroid/content/Context;->STATUS_BAR_SERVICE:Ljava/lang/String;
+Landroid/content/ContextWrapper;->createApplicationContext(Landroid/content/pm/ApplicationInfo;I)Landroid/content/Context;
Landroid/content/ContextWrapper;->getBasePackageName()Ljava/lang/String;
Landroid/content/ContextWrapper;->getDisplay()Landroid/view/Display;
Landroid/content/ContextWrapper;->mBase:Landroid/content/Context;
@@ -1494,6 +1502,8 @@
Landroid/content/pm/IPackageInstallObserver2;->onPackageInstalled(Ljava/lang/String;ILjava/lang/String;Landroid/os/Bundle;)V
Landroid/content/pm/IPackageInstallObserver2;->onUserActionRequired(Landroid/content/Intent;)V
Landroid/content/pm/IPackageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
+Landroid/content/pm/IPackageManager$Stub$Proxy;->checkUidPermission(Ljava/lang/String;I)I
+Landroid/content/pm/IPackageManager$Stub$Proxy;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String;
Landroid/content/pm/IPackageManager$Stub$Proxy;->getInstalledPackages(II)Landroid/content/pm/ParceledListSlice;
Landroid/content/pm/IPackageManager$Stub$Proxy;->getInstallLocation()I
Landroid/content/pm/IPackageManager$Stub$Proxy;->getPackageInfo(Ljava/lang/String;II)Landroid/content/pm/PackageInfo;
@@ -1514,6 +1524,7 @@
Landroid/content/pm/IPackageManager;->deleteApplicationCacheFiles(Ljava/lang/String;Landroid/content/pm/IPackageDataObserver;)V
Landroid/content/pm/IPackageManager;->enterSafeMode()V
Landroid/content/pm/IPackageManager;->getApplicationEnabledSetting(Ljava/lang/String;I)I
+Landroid/content/pm/IPackageManager;->getAppOpPermissionPackages(Ljava/lang/String;)[Ljava/lang/String;
Landroid/content/pm/IPackageManager;->getBlockUninstallForUser(Ljava/lang/String;I)Z
Landroid/content/pm/IPackageManager;->getComponentEnabledSetting(Landroid/content/ComponentName;I)I
Landroid/content/pm/IPackageManager;->getFlagsForUid(I)I
@@ -1783,6 +1794,7 @@
Landroid/content/pm/VerifierInfo;-><init>(Ljava/lang/String;Ljava/security/PublicKey;)V
Landroid/content/pm/XmlSerializerAndParser;->createFromXml(Lorg/xmlpull/v1/XmlPullParser;)Ljava/lang/Object;
Landroid/content/pm/XmlSerializerAndParser;->writeAsXml(Ljava/lang/Object;Lorg/xmlpull/v1/XmlSerializer;)V
+Landroid/content/res/ApkAssets;->getAssetPath()Ljava/lang/String;
Landroid/content/res/AssetFileDescriptor;->mFd:Landroid/os/ParcelFileDescriptor;
Landroid/content/res/AssetFileDescriptor;->mLength:J
Landroid/content/res/AssetFileDescriptor;->mStartOffset:J
@@ -1794,6 +1806,7 @@
Landroid/content/res/AssetManager;->addOverlayPath(Ljava/lang/String;)I
Landroid/content/res/AssetManager;->applyStyle(JIILandroid/content/res/XmlBlock$Parser;[IJJ)V
Landroid/content/res/AssetManager;->createTheme()J
+Landroid/content/res/AssetManager;->getApkAssets()[Landroid/content/res/ApkAssets;
Landroid/content/res/AssetManager;->getAssignedPackageIdentifiers()Landroid/util/SparseArray;
Landroid/content/res/AssetManager;->getGlobalAssetCount()I
Landroid/content/res/AssetManager;->getGlobalAssetManagerCount()I
@@ -1836,6 +1849,7 @@
Landroid/content/res/CompatibilityInfo$Translator;->translateRectInScreenToAppWinFrame(Landroid/graphics/Rect;)V
Landroid/content/res/CompatibilityInfo$Translator;->translateRegionInWindowToScreen(Landroid/graphics/Region;)V
Landroid/content/res/CompatibilityInfo$Translator;->translateWindowLayout(Landroid/view/WindowManager$LayoutParams;)V
+Landroid/content/res/CompatibilityInfo;-><init>()V
Landroid/content/res/CompatibilityInfo;-><init>(Landroid/content/pm/ApplicationInfo;IIZ)V
Landroid/content/res/CompatibilityInfo;->applicationScale:F
Landroid/content/res/CompatibilityInfo;->computeCompatibleScaling(Landroid/util/DisplayMetrics;Landroid/util/DisplayMetrics;)F
@@ -1849,6 +1863,7 @@
Landroid/content/res/Configuration;->resourceQualifierString(Landroid/content/res/Configuration;)Ljava/lang/String;
Landroid/content/res/Configuration;->seq:I
Landroid/content/res/Configuration;->userSetLocale:Z
+Landroid/content/res/ConfigurationBoundResourceCache;-><init>()V
Landroid/content/res/DrawableCache;-><init>()V
Landroid/content/res/DrawableCache;->getInstance(JLandroid/content/res/Resources;Landroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
Landroid/content/res/ObbInfo;->salt:[B
@@ -2727,6 +2742,7 @@
Landroid/media/AudioGainConfig;->mValues:[I
Landroid/media/AudioHandle;-><init>(I)V
Landroid/media/AudioHandle;->mId:I
+Landroid/media/AudioManager;-><init>()V
Landroid/media/AudioManager;-><init>(Landroid/content/Context;)V
Landroid/media/AudioManager;->abandonAudioFocusForCall()V
Landroid/media/AudioManager;->createAudioPatch([Landroid/media/AudioPatch;[Landroid/media/AudioPortConfig;[Landroid/media/AudioPortConfig;)I
@@ -2986,6 +3002,8 @@
Landroid/media/MediaPlayer;->getMediaTimeProvider()Landroid/media/MediaTimeProvider;
Landroid/media/MediaPlayer;->getMetadata(ZZ)Landroid/media/Metadata;
Landroid/media/MediaPlayer;->invoke(Landroid/os/Parcel;Landroid/os/Parcel;)V
+Landroid/media/MediaPlayer;->MEDIA_INFO_EXTERNAL_METADATA_UPDATE:I
+Landroid/media/MediaPlayer;->MEDIA_INFO_TIMED_TEXT_ERROR:I
Landroid/media/MediaPlayer;->METADATA_ALL:Z
Landroid/media/MediaPlayer;->mEventHandler:Landroid/media/MediaPlayer$EventHandler;
Landroid/media/MediaPlayer;->mOnCompletionListener:Landroid/media/MediaPlayer$OnCompletionListener;
@@ -3331,6 +3349,7 @@
Landroid/net/INetworkStatsService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/net/INetworkStatsService$Stub$Proxy;->getMobileIfaces()[Ljava/lang/String;
Landroid/net/INetworkStatsService;->forceUpdate()V
+Landroid/net/INetworkStatsService;->getDataLayerSnapshotForUid(I)Landroid/net/NetworkStats;
Landroid/net/INetworkStatsService;->getMobileIfaces()[Ljava/lang/String;
Landroid/net/INetworkStatsService;->openSession()Landroid/net/INetworkStatsSession;
Landroid/net/INetworkStatsService;->openSessionForUsageStats(ILjava/lang/String;)Landroid/net/INetworkStatsSession;
@@ -3353,6 +3372,7 @@
Landroid/net/LinkProperties;->getAddresses()Ljava/util/List;
Landroid/net/LinkProperties;->getAllAddresses()Ljava/util/List;
Landroid/net/LinkProperties;->getAllLinkAddresses()Ljava/util/List;
+Landroid/net/LinkProperties;->getTcpBufferSizes()Ljava/lang/String;
Landroid/net/LinkProperties;->isIdenticalHttpProxy(Landroid/net/LinkProperties;)Z
Landroid/net/LinkProperties;->isIdenticalInterfaceName(Landroid/net/LinkProperties;)Z
Landroid/net/LinkProperties;->mIfaceName:Ljava/lang/String;
@@ -3763,6 +3783,7 @@
Landroid/os/AsyncTask;->mWorker:Landroid/os/AsyncTask$WorkerRunnable;
Landroid/os/AsyncTask;->sDefaultExecutor:Ljava/util/concurrent/Executor;
Landroid/os/AsyncTask;->setDefaultExecutor(Ljava/util/concurrent/Executor;)V
+Landroid/os/BaseBundle;->isParcelled()Z
Landroid/os/BaseBundle;->mMap:Landroid/util/ArrayMap;
Landroid/os/BaseBundle;->mParcelledData:Landroid/os/Parcel;
Landroid/os/BaseBundle;->unparcel()V
@@ -6887,6 +6908,7 @@
Landroid/widget/Gallery;->mSpacing:I
Landroid/widget/Gallery;->trackMotionScroll(I)V
Landroid/widget/GridLayout;->UNDEFINED_ALIGNMENT:Landroid/widget/GridLayout$Alignment;
+Landroid/widget/GridView;->determineColumns(I)Z
Landroid/widget/GridView;->fillDown(II)Landroid/view/View;
Landroid/widget/GridView;->fillUp(II)Landroid/view/View;
Landroid/widget/GridView;->mColumnWidth:I
diff --git a/config/preloaded-classes b/config/preloaded-classes
index 2971ef8..0014793 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -2771,10 +2771,8 @@
android.security.net.config.RootTrustManager
android.security.net.config.RootTrustManagerFactorySpi
android.security.net.config.SystemCertificateSource
-android.security.net.config.SystemCertificateSource$NoPreloadHolder
android.security.net.config.TrustedCertificateStoreAdapter
android.security.net.config.UserCertificateSource
-android.security.net.config.UserCertificateSource$NoPreloadHolder
android.security.net.config.XmlConfigSource
android.security.net.config.XmlConfigSource$ParserException
android.service.media.IMediaBrowserService
@@ -4556,7 +4554,6 @@
com.android.org.conscrypt.PeerInfoProvider
com.android.org.conscrypt.PeerInfoProvider$1
com.android.org.conscrypt.Platform
-com.android.org.conscrypt.Platform$NoPreloadHolder
com.android.org.conscrypt.Preconditions
com.android.org.conscrypt.SSLClientSessionCache
com.android.org.conscrypt.SSLParametersImpl
@@ -6072,7 +6069,6 @@
javax.net.ssl.HandshakeCompletedListener
javax.net.ssl.HostnameVerifier
javax.net.ssl.HttpsURLConnection
-javax.net.ssl.HttpsURLConnection$NoPreloadHolder
javax.net.ssl.KeyManager
javax.net.ssl.KeyManagerFactory
javax.net.ssl.KeyManagerFactory$1
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 929e119..e7d3525 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -2177,7 +2177,8 @@
}
/**
- * @return Whether or not the snapshot is of a translucent app window.
+ * @return Whether or not the snapshot is of a translucent app window (non-fullscreen or has
+ * a non-opaque pixel format).
*/
public boolean isTranslucent() {
return mIsTranslucent;
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 1d35ba2..6557ac4 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -291,10 +291,7 @@
if (mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) {
mWindow.invalidatePanelMenu(Window.FEATURE_ACTION_BAR);
}
- if (mDecor.getVisibility() != View.VISIBLE) {
- mDecor.setVisibility(View.VISIBLE);
- sendShowMessage();
- }
+ mDecor.setVisibility(View.VISIBLE);
}
return;
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 1d1c738..7c9cb73 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -16,7 +16,7 @@
package android.app;
-import static com.android.internal.util.NotificationColorUtil.satisfiesTextContrast;
+import static com.android.internal.util.ContrastColorUtil.satisfiesTextContrast;
import android.annotation.ColorInt;
import android.annotation.DrawableRes;
@@ -79,7 +79,7 @@
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.internal.util.Preconditions;
import java.lang.annotation.Retention;
@@ -3176,7 +3176,7 @@
private Style mStyle;
private ArrayList<Action> mActions = new ArrayList<Action>(MAX_ACTION_BUTTONS);
private ArrayList<Person> mPersonList = new ArrayList<>();
- private NotificationColorUtil mColorUtil;
+ private ContrastColorUtil mColorUtil;
private boolean mIsLegacy;
private boolean mIsLegacyInitialized;
@@ -3307,9 +3307,9 @@
}
}
- private NotificationColorUtil getColorUtil() {
+ private ContrastColorUtil getColorUtil() {
if (mColorUtil == null) {
- mColorUtil = NotificationColorUtil.getInstance(mContext);
+ mColorUtil = ContrastColorUtil.getInstance(mContext);
}
return mColorUtil;
}
@@ -4427,7 +4427,7 @@
private CharSequence processTextSpans(CharSequence text) {
if (hasForegroundColor()) {
- return NotificationColorUtil.clearColorSpans(text);
+ return ContrastColorUtil.clearColorSpans(text);
}
return text;
}
@@ -4473,20 +4473,20 @@
|| mTextColorsAreForBackground != backgroundColor) {
mTextColorsAreForBackground = backgroundColor;
if (!hasForegroundColor() || !isColorized()) {
- mPrimaryTextColor = NotificationColorUtil.resolvePrimaryColor(mContext,
+ mPrimaryTextColor = ContrastColorUtil.resolvePrimaryColor(mContext,
backgroundColor);
- mSecondaryTextColor = NotificationColorUtil.resolveSecondaryColor(mContext,
+ mSecondaryTextColor = ContrastColorUtil.resolveSecondaryColor(mContext,
backgroundColor);
if (backgroundColor != COLOR_DEFAULT && isColorized()) {
- mPrimaryTextColor = NotificationColorUtil.findAlphaToMeetContrast(
+ mPrimaryTextColor = ContrastColorUtil.findAlphaToMeetContrast(
mPrimaryTextColor, backgroundColor, 4.5);
- mSecondaryTextColor = NotificationColorUtil.findAlphaToMeetContrast(
+ mSecondaryTextColor = ContrastColorUtil.findAlphaToMeetContrast(
mSecondaryTextColor, backgroundColor, 4.5);
}
} else {
- double backLum = NotificationColorUtil.calculateLuminance(backgroundColor);
- double textLum = NotificationColorUtil.calculateLuminance(mForegroundColor);
- double contrast = NotificationColorUtil.calculateContrast(mForegroundColor,
+ double backLum = ContrastColorUtil.calculateLuminance(backgroundColor);
+ double textLum = ContrastColorUtil.calculateLuminance(mForegroundColor);
+ double contrast = ContrastColorUtil.calculateContrast(mForegroundColor,
backgroundColor);
// We only respect the given colors if worst case Black or White still has
// contrast
@@ -4496,46 +4496,46 @@
&& !satisfiesTextContrast(backgroundColor, Color.WHITE);
if (contrast < 4.5f) {
if (backgroundLight) {
- mSecondaryTextColor = NotificationColorUtil.findContrastColor(
+ mSecondaryTextColor = ContrastColorUtil.findContrastColor(
mForegroundColor,
backgroundColor,
true /* findFG */,
4.5f);
- mPrimaryTextColor = NotificationColorUtil.changeColorLightness(
+ mPrimaryTextColor = ContrastColorUtil.changeColorLightness(
mSecondaryTextColor, -LIGHTNESS_TEXT_DIFFERENCE_LIGHT);
} else {
mSecondaryTextColor =
- NotificationColorUtil.findContrastColorAgainstDark(
+ ContrastColorUtil.findContrastColorAgainstDark(
mForegroundColor,
backgroundColor,
true /* findFG */,
4.5f);
- mPrimaryTextColor = NotificationColorUtil.changeColorLightness(
+ mPrimaryTextColor = ContrastColorUtil.changeColorLightness(
mSecondaryTextColor, -LIGHTNESS_TEXT_DIFFERENCE_DARK);
}
} else {
mPrimaryTextColor = mForegroundColor;
- mSecondaryTextColor = NotificationColorUtil.changeColorLightness(
+ mSecondaryTextColor = ContrastColorUtil.changeColorLightness(
mPrimaryTextColor, backgroundLight ? LIGHTNESS_TEXT_DIFFERENCE_LIGHT
: LIGHTNESS_TEXT_DIFFERENCE_DARK);
- if (NotificationColorUtil.calculateContrast(mSecondaryTextColor,
+ if (ContrastColorUtil.calculateContrast(mSecondaryTextColor,
backgroundColor) < 4.5f) {
// oh well the secondary is not good enough
if (backgroundLight) {
- mSecondaryTextColor = NotificationColorUtil.findContrastColor(
+ mSecondaryTextColor = ContrastColorUtil.findContrastColor(
mSecondaryTextColor,
backgroundColor,
true /* findFG */,
4.5f);
} else {
mSecondaryTextColor
- = NotificationColorUtil.findContrastColorAgainstDark(
+ = ContrastColorUtil.findContrastColorAgainstDark(
mSecondaryTextColor,
backgroundColor,
true /* findFG */,
4.5f);
}
- mPrimaryTextColor = NotificationColorUtil.changeColorLightness(
+ mPrimaryTextColor = ContrastColorUtil.changeColorLightness(
mSecondaryTextColor, backgroundLight
? -LIGHTNESS_TEXT_DIFFERENCE_LIGHT
: -LIGHTNESS_TEXT_DIFFERENCE_DARK);
@@ -5247,7 +5247,7 @@
ColorStateList[] outResultColor = null;
int background = resolveBackgroundColor();
if (isLegacy()) {
- title = NotificationColorUtil.clearColorSpans(title);
+ title = ContrastColorUtil.clearColorSpans(title);
} else {
outResultColor = new ColorStateList[1];
title = ensureColorSpanContrast(title, background, outResultColor);
@@ -5260,7 +5260,7 @@
// There's a span spanning the full text, let's take it and use it as the
// background color
background = outResultColor[0].getDefaultColor();
- int textColor = NotificationColorUtil.resolvePrimaryColor(mContext,
+ int textColor = ContrastColorUtil.resolvePrimaryColor(mContext,
background);
button.setTextColor(R.id.action0, textColor);
rippleColor = textColor;
@@ -5321,7 +5321,7 @@
int[] colors = textColor.getColors();
int[] newColors = new int[colors.length];
for (int i = 0; i < newColors.length; i++) {
- newColors[i] = NotificationColorUtil.ensureLargeTextContrast(
+ newColors[i] = ContrastColorUtil.ensureLargeTextContrast(
colors[i], background, mInNightMode);
}
textColor = new ColorStateList(textColor.getStates().clone(),
@@ -5341,7 +5341,7 @@
} else if (resultSpan instanceof ForegroundColorSpan) {
ForegroundColorSpan originalSpan = (ForegroundColorSpan) resultSpan;
int foregroundColor = originalSpan.getForegroundColor();
- foregroundColor = NotificationColorUtil.ensureLargeTextContrast(
+ foregroundColor = ContrastColorUtil.ensureLargeTextContrast(
foregroundColor, background, mInNightMode);
if (fullLength) {
outResultColor[0] = ColorStateList.valueOf(foregroundColor);
@@ -5441,14 +5441,14 @@
com.android.internal.R.color.notification_material_background_color);
if (mN.color == COLOR_DEFAULT) {
ensureColors();
- color = NotificationColorUtil.resolveDefaultColor(mContext, background);
+ color = ContrastColorUtil.resolveDefaultColor(mContext, background);
} else {
- color = NotificationColorUtil.resolveContrastColor(mContext, mN.color,
+ color = ContrastColorUtil.resolveContrastColor(mContext, mN.color,
background, mInNightMode);
}
if (Color.alpha(color) < 255) {
// alpha doesn't go well for color filters, so let's blend it manually
- color = NotificationColorUtil.compositeColors(color, background);
+ color = ContrastColorUtil.compositeColors(color, background);
}
mCachedContrastColorIsFor = mN.color;
return mCachedContrastColor = color;
@@ -5460,10 +5460,10 @@
}
int background = mContext.getColor(
com.android.internal.R.color.notification_material_background_color);
- mNeutralColor = NotificationColorUtil.resolveDefaultColor(mContext, background);
+ mNeutralColor = ContrastColorUtil.resolveDefaultColor(mContext, background);
if (Color.alpha(mNeutralColor) < 255) {
// alpha doesn't go well for color filters, so let's blend it manually
- mNeutralColor = NotificationColorUtil.compositeColors(mNeutralColor, background);
+ mNeutralColor = ContrastColorUtil.compositeColors(mNeutralColor, background);
}
return mNeutralColor;
}
@@ -5472,7 +5472,7 @@
if (mCachedAmbientColorIsFor == mN.color && mCachedAmbientColorIsFor != COLOR_INVALID) {
return mCachedAmbientColor;
}
- final int contrasted = NotificationColorUtil.resolveAmbientColor(mContext, mN.color);
+ final int contrasted = ContrastColorUtil.resolveAmbientColor(mContext, mN.color);
mCachedAmbientColorIsFor = mN.color;
return mCachedAmbientColor = contrasted;
@@ -7833,7 +7833,7 @@
// notification color. Otherwise, just use the passed-in color.
int tintColor = mBuilder.shouldTintActionButtons() || mBuilder.isColorized()
? color
- : NotificationColorUtil.resolveColor(mBuilder.mContext,
+ : ContrastColorUtil.resolveColor(mBuilder.mContext,
Notification.COLOR_DEFAULT);
button.setDrawableTint(R.id.action0, false, tintColor,
diff --git a/core/java/android/app/WallpaperColors.java b/core/java/android/app/WallpaperColors.java
index 60e8a12..626b3be 100644
--- a/core/java/android/app/WallpaperColors.java
+++ b/core/java/android/app/WallpaperColors.java
@@ -25,12 +25,15 @@
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.Log;
import android.util.Size;
import com.android.internal.graphics.ColorUtils;
import com.android.internal.graphics.palette.Palette;
import com.android.internal.graphics.palette.VariationalKMeansQuantizer;
+import com.android.internal.util.ContrastColorUtil;
+import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -44,6 +47,8 @@
*/
public final class WallpaperColors implements Parcelable {
+ private static final boolean DEBUG_DARK_PIXELS = false;
+
/**
* Specifies that dark text is preferred over the current wallpaper for best presentation.
* <p>
@@ -83,8 +88,8 @@
private static final float BRIGHT_IMAGE_MEAN_LUMINANCE = 0.75f;
// We also check if the image has dark pixels in it,
// to avoid bright images with some dark spots.
- private static final float DARK_PIXEL_LUMINANCE = 0.45f;
- private static final float MAX_DARK_AREA = 0.05f;
+ private static final float DARK_PIXEL_CONTRAST = 6f;
+ private static final float MAX_DARK_AREA = 0.025f;
private final ArrayList<Color> mMainColors;
private int mColorHints;
@@ -382,8 +387,13 @@
final int alpha = Color.alpha(pixels[i]);
// Make sure we don't have a dark pixel mass that will
// make text illegible.
- if (luminance < DARK_PIXEL_LUMINANCE && alpha != 0) {
+ final boolean satisfiesTextContrast = ContrastColorUtil
+ .calculateContrast(pixels[i], Color.BLACK) > DARK_PIXEL_CONTRAST;
+ if (!satisfiesTextContrast && alpha != 0) {
darkPixels++;
+ if (DEBUG_DARK_PIXELS) {
+ pixels[i] = Color.RED;
+ }
}
totalLuminance += luminance;
}
@@ -397,6 +407,18 @@
hints |= HINT_SUPPORTS_DARK_THEME;
}
+ if (DEBUG_DARK_PIXELS) {
+ try (FileOutputStream out = new FileOutputStream("/data/pixels.png")) {
+ source.setPixels(pixels, 0, source.getWidth(), 0, 0, source.getWidth(),
+ source.getHeight());
+ source.compress(Bitmap.CompressFormat.PNG, 100, out);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Log.d("WallpaperColors", "l: " + meanLuminance + ", d: " + darkPixels +
+ " maxD: " + maxDarkPixels + " numPixels: " + pixels.length);
+ }
+
return hints;
}
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java
index e7ae32d..912baf9 100644
--- a/core/java/android/app/backup/BackupManager.java
+++ b/core/java/android/app/backup/BackupManager.java
@@ -253,20 +253,27 @@
}
/**
- * @deprecated Since Android P app can no longer request restoring of its backup.
+ * @deprecated Applications shouldn't request a restore operation using this method. In Android
+ * P and later, this method is a no-op.
*
- * Restore the calling application from backup. The data will be restored from the
+ * <p>Restore the calling application from backup. The data will be restored from the
* current backup dataset if the application has stored data there, or from
* the dataset used during the last full device setup operation if the current
* backup dataset has no matching data. If no backup data exists for this application
- * in either source, a nonzero value will be returned.
+ * in either source, a non-zero value is returned.
*
- * <p>If this method returns zero (meaning success), the OS will attempt to retrieve
- * a backed-up dataset from the remote transport, instantiate the application's
- * backup agent, and pass the dataset to the agent's
+ * <p>If this method returns zero (meaning success), the OS attempts to retrieve a backed-up
+ * dataset from the remote transport, instantiate the application's backup agent, and pass the
+ * dataset to the agent's
* {@link android.app.backup.BackupAgent#onRestore(BackupDataInput, int, android.os.ParcelFileDescriptor) onRestore()}
* method.
*
+ * <p class="caution">Unlike other restore operations, this method doesn't terminate the
+ * application after the restore. The application continues running to receive the
+ * {@link RestoreObserver} callbacks on the {@code observer} argument. Full backups use an
+ * {@link android.app.Application Application} base class while key-value backups use the
+ * application subclass declared in the AndroidManifest.xml {@code <application>} tag.
+ *
* @param observer The {@link RestoreObserver} to receive callbacks during the restore
* operation. This must not be null.
*
@@ -282,7 +289,7 @@
/**
* @deprecated Since Android P app can no longer request restoring of its backup.
*
- * Restore the calling application from backup. The data will be restored from the
+ * <p>Restore the calling application from backup. The data will be restored from the
* current backup dataset if the application has stored data there, or from
* the dataset used during the last full device setup operation if the current
* backup dataset has no matching data. If no backup data exists for this application
@@ -656,7 +663,7 @@
}
return false;
}
-
+
/**
* Request an immediate backup, providing an observer to which results of the backup operation
* will be published. The Android backup system will decide for each package whether it will
diff --git a/core/java/android/app/usage/IUsageStatsManager.aidl b/core/java/android/app/usage/IUsageStatsManager.aidl
index 00d8711..9713527 100644
--- a/core/java/android/app/usage/IUsageStatsManager.aidl
+++ b/core/java/android/app/usage/IUsageStatsManager.aidl
@@ -36,6 +36,8 @@
String callingPackage);
UsageEvents queryEvents(long beginTime, long endTime, String callingPackage);
UsageEvents queryEventsForPackage(long beginTime, long endTime, String callingPackage);
+ UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String callingPackage);
+ UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg, String callingPackage);
void setAppInactive(String packageName, boolean inactive, int userId);
boolean isAppInactive(String packageName, int userId);
void whitelistAppTemporarily(String packageName, long duration, int userId);
diff --git a/core/java/android/bluetooth/le/ScanRecord.java b/core/java/android/bluetooth/le/ScanRecord.java
index f8aaba9..04dd060 100644
--- a/core/java/android/bluetooth/le/ScanRecord.java
+++ b/core/java/android/bluetooth/le/ScanRecord.java
@@ -117,7 +117,7 @@
*/
@Nullable
public byte[] getServiceData(ParcelUuid serviceDataUuid) {
- if (serviceDataUuid == null) {
+ if (serviceDataUuid == null || mServiceData == null) {
return null;
}
return mServiceData.get(serviceDataUuid);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 1bc3bc9..3dfabdd 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -6994,6 +6994,7 @@
"<INTENT> specifications include these flags and arguments:",
" [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]",
" [-c <CATEGORY> [-c <CATEGORY>] ...]",
+ " [-n <COMPONENT_NAME>]",
" [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]",
" [--esn <EXTRA_KEY> ...]",
" [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]",
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 03e600e..c988fa9 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -598,8 +598,6 @@
boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
boolean getApplicationHiddenSettingAsUser(String packageName, int userId);
- boolean setSystemAppInstallState(String packageName, boolean installed, int userId);
-
IPackageInstaller getPackageInstaller();
boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 8d2c511..43b6984 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -147,7 +147,6 @@
GET_DISABLED_COMPONENTS,
GET_DISABLED_UNTIL_USED_COMPONENTS,
GET_UNINSTALLED_PACKAGES,
- MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS,
})
@Retention(RetentionPolicy.SOURCE)
public @interface PackageInfoFlags {}
@@ -165,7 +164,6 @@
MATCH_STATIC_SHARED_LIBRARIES,
GET_DISABLED_UNTIL_USED_COMPONENTS,
GET_UNINSTALLED_PACKAGES,
- MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ApplicationInfoFlags {}
@@ -524,12 +522,6 @@
public static final int MATCH_DEBUG_TRIAGED_MISSING = 0x10000000;
/**
- * Internal flag used to indicate that a package is a hidden system app.
- * @hide
- */
- public static final int MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS = 0x20000000;
-
- /**
* Flag for {@link #addCrossProfileIntentFilter}: if this flag is set: when
* resolving an intent that matches the {@code CrossProfileIntentFilter},
* the current profile will be skipped. Only activities in the target user
@@ -1965,8 +1957,6 @@
* </ul>
* A version of 1.1.0 or higher also indicates:
* <ul>
- * <li>The {@code VK_ANDROID_external_memory_android_hardware_buffer} extension is
- * supported.</li>
* <li>{@code SYNC_FD} external semaphore and fence handles are supported.</li>
* <li>{@code VkPhysicalDeviceSamplerYcbcrConversionFeatures::samplerYcbcrConversion} is
* supported.</li>
@@ -4857,8 +4847,7 @@
* on the system for other users, also install it for the specified user.
* @hide
*/
- @RequiresPermission(anyOf = {
- Manifest.permission.INSTALL_EXISTING_PACKAGES,
+ @RequiresPermission(anyOf = {
Manifest.permission.INSTALL_PACKAGES,
Manifest.permission.INTERACT_ACROSS_USERS_FULL})
public abstract int installExistingPackageAsUser(String packageName, @UserIdInt int userId)
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index b8eb074..9dbb2df 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -40,6 +40,7 @@
import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
+import android.Manifest;
import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -303,7 +304,13 @@
android.os.Build.VERSION_CODES.JELLY_BEAN),
new PackageParser.SplitPermissionInfo(android.Manifest.permission.WRITE_CONTACTS,
new String[] { android.Manifest.permission.WRITE_CALL_LOG },
- android.os.Build.VERSION_CODES.JELLY_BEAN)
+ android.os.Build.VERSION_CODES.JELLY_BEAN),
+ new PackageParser.SplitPermissionInfo(Manifest.permission.ACCESS_FINE_LOCATION,
+ new String[] { android.Manifest.permission.ACCESS_BACKGROUND_LOCATION },
+ android.os.Build.VERSION_CODES.P0),
+ new PackageParser.SplitPermissionInfo(Manifest.permission.ACCESS_COARSE_LOCATION,
+ new String[] { android.Manifest.permission.ACCESS_BACKGROUND_LOCATION },
+ android.os.Build.VERSION_CODES.P0),
};
/**
@@ -639,19 +646,11 @@
*/
private static boolean checkUseInstalledOrHidden(int flags, PackageUserState state,
ApplicationInfo appInfo) {
- // Returns false if the package is hidden system app until installed.
- if ((flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) == 0
- && !state.installed
- && appInfo != null && appInfo.isSystemApp()) {
- return false;
- }
-
// If available for the target user, or trying to match uninstalled packages and it's
// a system app.
return state.isAvailable(flags)
|| (appInfo != null && appInfo.isSystemApp()
- && ((flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0
- || (flags & PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS) != 0));
+ && (flags & PackageManager.MATCH_KNOWN_PACKAGES) != 0);
}
public static boolean isAvailable(PackageUserState state) {
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index c5cb1f5..104134a 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -125,8 +125,8 @@
/**
* A temporary hack until SUPL system can get off the legacy APIS.
* They do too many network requests and the long list of apps listening
- * and waking due to the CONNECTIVITY_ACTION bcast makes it expensive.
- * Use this bcast intent instead for SUPL requests.
+ * and waking due to the CONNECTIVITY_ACTION broadcast makes it expensive.
+ * Use this broadcast intent instead for SUPL requests.
* @hide
*/
public static final String CONNECTIVITY_ACTION_SUPL =
@@ -152,7 +152,7 @@
* call {@link CaptivePortal#reportCaptivePortalDismissed} so the system can
* reevaluate the network. If reevaluation finds the network no longer
* subject to a captive portal, the network may become the default active
- * data network. </li>
+ * data network.</li>
* <li> When the app handling this action believes the user explicitly wants
* to ignore the captive portal and the network, the app should call
* {@link CaptivePortal#ignoreNetwork}. </li>
@@ -260,7 +260,8 @@
* {@hide}
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
- public static final String ACTION_DATA_ACTIVITY_CHANGE = "android.net.conn.DATA_ACTIVITY_CHANGE";
+ public static final String ACTION_DATA_ACTIVITY_CHANGE =
+ "android.net.conn.DATA_ACTIVITY_CHANGE";
/**
* The lookup key for an enum that indicates the network device type on which this data activity
* change happens.
@@ -391,14 +392,14 @@
/**
* Invalid tethering type.
- * @see #startTethering(int, OnStartTetheringCallback, boolean)
+ * @see #startTethering(int, boolean, OnStartTetheringCallback)
* @hide
*/
public static final int TETHERING_INVALID = -1;
/**
* Wifi tethering type.
- * @see #startTethering(int, OnStartTetheringCallback, boolean)
+ * @see #startTethering(int, boolean, OnStartTetheringCallback)
* @hide
*/
@SystemApi
@@ -406,7 +407,7 @@
/**
* USB tethering type.
- * @see #startTethering(int, OnStartTetheringCallback, boolean)
+ * @see #startTethering(int, boolean, OnStartTetheringCallback)
* @hide
*/
@SystemApi
@@ -414,7 +415,7 @@
/**
* Bluetooth tethering type.
- * @see #startTethering(int, OnStartTetheringCallback, boolean)
+ * @see #startTethering(int, boolean, OnStartTetheringCallback)
* @hide
*/
@SystemApi
@@ -664,7 +665,7 @@
/**
* Static unique request used as a tombstone for NetworkCallbacks that have been unregistered.
* This allows to distinguish when unregistering NetworkCallbacks those that were never
- * registered and those that were already unregistered.
+ * registered from those that were already unregistered.
* @hide
*/
private static final NetworkRequest ALREADY_UNREGISTERED =
@@ -1494,8 +1495,8 @@
};
}
- private static HashMap<NetworkCapabilities, LegacyRequest> sLegacyRequests =
- new HashMap<NetworkCapabilities, LegacyRequest>();
+ private static final HashMap<NetworkCapabilities, LegacyRequest> sLegacyRequests =
+ new HashMap<>();
private NetworkRequest findRequestForFeature(NetworkCapabilities netCap) {
synchronized (sLegacyRequests) {
@@ -1635,8 +1636,9 @@
* {@code onStarted} method will be called. If an error occurs, {@code onError} will be called,
* specifying one of the {@code ERROR_*} constants in this class.
*
- * To stop an existing keepalive, call {@link stop}. The system will call {@code onStopped} if
- * the operation was successfull or {@code onError} if an error occurred.
+ * To stop an existing keepalive, call {@link PacketKeepalive#stop}. The system will call
+ * {@link PacketKeepaliveCallback#onStopped} if the operation was successful or
+ * {@link PacketKeepaliveCallback#onError} if an error occurred.
*
* @hide
*/
@@ -1897,7 +1899,7 @@
* to initiate network traffic), you can retrieve its instantaneous state with
* {@link ConnectivityManager#isDefaultNetworkActive}.
*/
- public void onNetworkActive();
+ void onNetworkActive();
}
private INetworkManagementService getNetworkManagementService() {
@@ -1912,8 +1914,7 @@
}
private final ArrayMap<OnNetworkActiveListener, INetworkActivityListener>
- mNetworkActivityListeners
- = new ArrayMap<OnNetworkActiveListener, INetworkActivityListener>();
+ mNetworkActivityListeners = new ArrayMap<>();
/**
* Start listening to reports when the system's default data network is active, meaning it is
@@ -2216,12 +2217,12 @@
/**
* Called when tethering has been successfully started.
*/
- public void onTetheringStarted() {};
+ public void onTetheringStarted() {}
/**
* Called when starting tethering failed.
*/
- public void onTetheringFailed() {};
+ public void onTetheringFailed() {}
}
/**
@@ -2658,9 +2659,6 @@
/**
* Set sign in error notification to visible or in visible
*
- * @param visible
- * @param networkType
- *
* {@hide}
* @deprecated Doesn't properly deal with multiple connected networks of the same type.
*/
@@ -2869,7 +2867,7 @@
* @hide
*/
public interface Errors {
- static int TOO_MANY_REQUESTS = 1;
+ int TOO_MANY_REQUESTS = 1;
}
/** @hide */
@@ -3126,7 +3124,7 @@
* as these {@code NetworkCapabilities} represent states that a particular
* network may never attain, and whether a network will attain these states
* is unknown prior to bringing up the network so the framework does not
- * know how to go about satisfing a request with these capabilities.
+ * know how to go about satisfying a request with these capabilities.
*
* <p>This method requires the caller to hold either the
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE} permission
@@ -3186,7 +3184,7 @@
* Request a network to satisfy a set of {@link android.net.NetworkCapabilities}, limited
* by a timeout.
*
- * This function behaves identically to the non-timedout version, but if a suitable
+ * This function behaves identically to the version without timeout, but if a suitable
* network is not found within the given time (in milliseconds) the
* {@link NetworkCallback#onUnavailable} callback is called. The request can still be
* released normally by calling {@link #unregisterNetworkCallback(NetworkCallback)} but does
@@ -3267,7 +3265,7 @@
* as these {@code NetworkCapabilities} represent states that a particular
* network may never attain, and whether a network will attain these states
* is unknown prior to bringing up the network so the framework does not
- * know how to go about satisfing a request with these capabilities.
+ * know how to go about satisfying a request with these capabilities.
*
* <p>This method requires the caller to hold either the
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE} permission
@@ -3432,9 +3430,9 @@
// capabilities, this request is guaranteed, at all times, to be
// satisfied by the same network, if any, that satisfies the default
// request, i.e., the system default network.
- NetworkCapabilities nullCapabilities = null;
CallbackHandler cbHandler = new CallbackHandler(handler);
- sendRequestForNetwork(nullCapabilities, networkCallback, 0, REQUEST, TYPE_NONE, cbHandler);
+ sendRequestForNetwork(null /* NetworkCapabilities need */, networkCallback, 0,
+ REQUEST, TYPE_NONE, cbHandler);
}
/**
@@ -3669,7 +3667,7 @@
* @return {@code true} on success, {@code false} if the {@link Network} is no longer valid.
*/
public boolean bindProcessToNetwork(Network network) {
- // Forcing callers to call thru non-static function ensures ConnectivityManager
+ // Forcing callers to call through non-static function ensures ConnectivityManager
// instantiated.
return setProcessDefaultNetwork(network);
}
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 300a78b..ab29d99 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -774,7 +774,7 @@
String usePrivateDns = "UsePrivateDns: " + mUsePrivateDns + " ";
String privateDnsServerName = "";
- if (privateDnsServerName != null) {
+ if (mPrivateDnsServerName != null) {
privateDnsServerName = "PrivateDnsServerName: " + mPrivateDnsServerName + " ";
}
@@ -810,7 +810,7 @@
stacked += "] ";
}
return "{" + ifaceName + linkAddresses + routes + dns + usePrivateDns
- + privateDnsServerName + domainName + mtu + tcpBuffSizes + proxy
+ + privateDnsServerName + validatedPrivateDns + domainName + mtu + tcpBuffSizes + proxy
+ stacked + "}";
}
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index e25043d..80c534c 100644
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -923,6 +923,12 @@
* engaged. It's now time to see if you can dance.</em>
*/
public static final int Q = CUR_DEVELOPMENT;
+
+ /**
+ * Stub for a potential new API level after P.
+ * @hide
+ */
+ public static final int P0 = Q;
}
/** The type of build, like "user" or "eng". */
diff --git a/core/java/android/os/ParcelFileDescriptor.aidl b/core/java/android/os/ParcelFileDescriptor.aidl
index 6bbd99e..c07b980 100644
--- a/core/java/android/os/ParcelFileDescriptor.aidl
+++ b/core/java/android/os/ParcelFileDescriptor.aidl
@@ -17,4 +17,4 @@
package android.os;
-parcelable ParcelFileDescriptor cpp_header "android/os/parcel_file_descriptor.h";
+parcelable ParcelFileDescriptor cpp_header "binder/ParcelFileDescriptor.h";
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index bc3d870..7a214b1 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2667,6 +2667,12 @@
if (isDeviceInDemoMode(mContext)) {
return false;
}
+ // If user disabled this feature, don't show switcher
+ final boolean userSwitcherEnabled = Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.USER_SWITCHER_ENABLED, 1) != 0;
+ if (!userSwitcherEnabled) {
+ return false;
+ }
List<UserInfo> users = getUsers(true);
if (users == null) {
return false;
diff --git a/core/java/android/os/storage/VolumeInfo.java b/core/java/android/os/storage/VolumeInfo.java
index 8d4c3c3..8c77502 100644
--- a/core/java/android/os/storage/VolumeInfo.java
+++ b/core/java/android/os/storage/VolumeInfo.java
@@ -312,7 +312,9 @@
* {@link android.Manifest.permission#WRITE_MEDIA_STORAGE}.
*/
public File getInternalPathForUser(int userId) {
- if (type == TYPE_PUBLIC) {
+ if (path == null) {
+ return null;
+ } else if (type == TYPE_PUBLIC) {
// TODO: plumb through cleaner path from vold
return new File(path.replace("/storage/", "/mnt/media_rw/"));
} else {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 25cdccf..0215e50 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -9432,6 +9432,12 @@
public static final String USE_GOOGLE_MAIL = "use_google_mail";
/**
+ * Whether or not switching/creating users is enabled by user.
+ * @hide
+ */
+ public static final String USER_SWITCHER_ENABLED = "user_switcher_enabled";
+
+ /**
* Webview Data reduction proxy key.
* @hide
*/
@@ -11039,6 +11045,15 @@
= "user_absent_radios_off_for_small_battery_enabled";
/**
+ * Whether or not to enable the User Absent, Touch Off feature on small battery devices.
+ * Type: int (0 for false, 1 for true)
+ * Default: 0
+ * @hide
+ */
+ public static final String USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED
+ = "user_absent_touch_off_for_small_battery_enabled";
+
+ /**
* Whether or not to turn on Wifi when proxy is disconnected.
* Type: int (0 for false, 1 for true)
* Default: 1
@@ -12849,16 +12864,6 @@
"zram_enabled";
/**
- * Whether we have enable CPU frequency scaling for this device.
- * For Wear, default is disable.
- *
- * The value is "1" for enable, "0" for disable.
- * @hide
- */
- public static final String CPU_SCALING_ENABLED =
- "cpu_frequency_scaling_enabled";
-
- /**
* Configuration flags for smart replies in notifications.
* This is encoded as a key=value list, separated by commas. Ex:
*
@@ -12945,15 +12950,6 @@
"backup_agent_timeout_parameters";
/**
- * Whether we have enabled swapping on this device. For Wear, default is
- * enabled.
- *
- * The value is "1" for enable, "0" for disable.
- * @hide
- */
- public static final String SWAP_ENABLED = "swap_enabled";
-
- /**
* Blacklist of GNSS satellites.
*
* This is a list of integers separated by commas to represent pairs of (constellation,
diff --git a/core/java/android/service/autofill/TextValueSanitizer.java b/core/java/android/service/autofill/TextValueSanitizer.java
index e5ad77a..a8c080a 100644
--- a/core/java/android/service/autofill/TextValueSanitizer.java
+++ b/core/java/android/service/autofill/TextValueSanitizer.java
@@ -37,7 +37,7 @@
* <p>For example, to remove spaces from groups of 4-digits in a credit card:
*
* <pre class="prettyprint">
- * new TextValueSanitizer(Pattern.compile("^(\\d{4})\\s?(\\d{4})\\s?(\\d{4})\\s?(\\d{4})$",
+ * new TextValueSanitizer(Pattern.compile("^(\\d{4})\\s?(\\d{4})\\s?(\\d{4})\\s?(\\d{4})$"),
* "$1$2$3$4")
* </pre>
*/
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index e17c8e7..4b78aa2 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -124,8 +124,6 @@
b.mText = null;
b.mLeftIndents = null;
b.mRightIndents = null;
- b.mLeftPaddings = null;
- b.mRightPaddings = null;
sPool.release(b);
}
@@ -135,8 +133,6 @@
mPaint = null;
mLeftIndents = null;
mRightIndents = null;
- mLeftPaddings = null;
- mRightPaddings = null;
}
public Builder setText(CharSequence source) {
@@ -364,28 +360,6 @@
}
/**
- * Set available paddings to draw overhanging text on. Arguments are arrays holding the
- * amount of padding available, one per line, measured in pixels. For lines past the last
- * element in the array, the last element repeats.
- *
- * The individual padding amounts should be non-negative. The result of passing negative
- * paddings is undefined.
- *
- * @param leftPaddings array of amounts of available padding for left margin, in pixels
- * @param rightPaddings array of amounts of available padding for right margin, in pixels
- * @return this builder, useful for chaining
- *
- * @hide
- */
- @NonNull
- public Builder setAvailablePaddings(@Nullable int[] leftPaddings,
- @Nullable int[] rightPaddings) {
- mLeftPaddings = leftPaddings;
- mRightPaddings = rightPaddings;
- return this;
- }
-
- /**
* Set paragraph justification mode. The default value is
* {@link Layout#JUSTIFICATION_MODE_NONE}. If the last line is too short for justification,
* the last line will be displayed with the alignment set by {@link #setAlignment}.
@@ -445,8 +419,6 @@
private int mHyphenationFrequency;
@Nullable private int[] mLeftIndents;
@Nullable private int[] mRightIndents;
- @Nullable private int[] mLeftPaddings;
- @Nullable private int[] mRightPaddings;
private int mJustificationMode;
private boolean mAddLastLineLineSpacing;
@@ -596,8 +568,6 @@
mLeftIndents = b.mLeftIndents;
mRightIndents = b.mRightIndents;
- mLeftPaddings = b.mLeftPaddings;
- mRightPaddings = b.mRightPaddings;
setJustificationMode(b.mJustificationMode);
generate(b, b.mIncludePad, b.mIncludePad);
@@ -649,7 +619,7 @@
b.mBreakStrategy, b.mHyphenationFrequency,
// TODO: Support more justification mode, e.g. letter spacing, stretching.
b.mJustificationMode != Layout.JUSTIFICATION_MODE_NONE,
- indents, mLeftPaddings, mRightPaddings);
+ indents);
PrecomputedText.ParagraphInfo[] paragraphInfo = null;
final Spanned spanned = (source instanceof Spanned) ? (Spanned) source : null;
@@ -1341,9 +1311,7 @@
@BreakStrategy int breakStrategy,
@HyphenationFrequency int hyphenationFrequency,
boolean isJustified,
- @Nullable int[] indents,
- @Nullable int[] leftPaddings,
- @Nullable int[] rightPaddings);
+ @Nullable int[] indents);
@CriticalNative
private static native void nFinish(long nativePtr);
@@ -1442,6 +1410,4 @@
@Nullable private int[] mLeftIndents;
@Nullable private int[] mRightIndents;
- @Nullable private int[] mLeftPaddings;
- @Nullable private int[] mRightPaddings;
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 42e1adc..4ec07fc 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -11905,6 +11905,7 @@
if ((getVisibility() == VISIBLE)
|| (changeType == AccessibilityEvent.CONTENT_CHANGE_TYPE_PANE_DISAPPEARED)) {
final AccessibilityEvent event = AccessibilityEvent.obtain();
+ onInitializeAccessibilityEvent(event);
event.setEventType(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
event.setContentChangeTypes(changeType);
event.setSource(this);
@@ -26901,10 +26902,10 @@
* version supported by the application. For example, the method
* {@link View#onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo)} is not available
* in API version 4 when the accessibility APIs were first introduced. If a
- * developer would like his application to run on API version 4 devices (assuming
+ * developer would like their application to run on API version 4 devices (assuming
* all other APIs used by the application are version 4 or lower) and take advantage
* of this method, instead of overriding the method which would break the application's
- * backwards compatibility, he can override the corresponding method in this
+ * backwards compatibility, they can override the corresponding method in this
* delegate and register the delegate in the target View if the API version of
* the system is high enough, i.e. the API version is the same as or higher than the API
* version that introduced
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index d839d75..dd24185 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -3297,8 +3297,11 @@
}
useAsyncReport = true;
- mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this, mNextRtFrameCallback);
+
+ // draw(...) might invoke post-draw, which might register the next callback already.
+ final FrameDrawingCallback callback = mNextRtFrameCallback;
mNextRtFrameCallback = null;
+ mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this, callback);
} else {
// If we get here with a disabled & requested hardware renderer, something went
// wrong (an invalidate posted right before we destroyed the hardware surface
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index fde9c0d..a6b8eb3 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -686,7 +686,9 @@
CONTENT_CHANGE_TYPE_SUBTREE,
CONTENT_CHANGE_TYPE_TEXT,
CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION,
- CONTENT_CHANGE_TYPE_PANE_TITLE
+ CONTENT_CHANGE_TYPE_PANE_TITLE,
+ CONTENT_CHANGE_TYPE_PANE_APPEARED,
+ CONTENT_CHANGE_TYPE_PANE_DISAPPEARED
})
public @interface ContentChangeTypes {}
@@ -875,6 +877,8 @@
* <li>{@link #CONTENT_CHANGE_TYPE_TEXT}
* <li>{@link #CONTENT_CHANGE_TYPE_PANE_TITLE}
* <li>{@link #CONTENT_CHANGE_TYPE_UNDEFINED}
+ * <li>{@link #CONTENT_CHANGE_TYPE_PANE_APPEARED}
+ * <li>{@link #CONTENT_CHANGE_TYPE_PANE_DISAPPEARED}
* </ul>
*/
@ContentChangeTypes
@@ -888,13 +892,15 @@
private static String singleContentChangeTypeToString(int type) {
switch (type) {
- case CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION: {
+ case CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION:
return "CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION";
- }
case CONTENT_CHANGE_TYPE_SUBTREE: return "CONTENT_CHANGE_TYPE_SUBTREE";
case CONTENT_CHANGE_TYPE_TEXT: return "CONTENT_CHANGE_TYPE_TEXT";
case CONTENT_CHANGE_TYPE_PANE_TITLE: return "CONTENT_CHANGE_TYPE_PANE_TITLE";
case CONTENT_CHANGE_TYPE_UNDEFINED: return "CONTENT_CHANGE_TYPE_UNDEFINED";
+ case CONTENT_CHANGE_TYPE_PANE_APPEARED: return "CONTENT_CHANGE_TYPE_PANE_APPEARED";
+ case CONTENT_CHANGE_TYPE_PANE_DISAPPEARED:
+ return "CONTENT_CHANGE_TYPE_PANE_DISAPPEARED";
default: return Integer.toHexString(type);
}
}
@@ -945,6 +951,7 @@
return "WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED";
case WINDOWS_CHANGE_PARENT: return "WINDOWS_CHANGE_PARENT";
case WINDOWS_CHANGE_CHILDREN: return "WINDOWS_CHANGE_CHILDREN";
+ case WINDOWS_CHANGE_PIP: return "WINDOWS_CHANGE_PIP";
default: return Integer.toHexString(type);
}
}
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 7555fff..1258a9e 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -1582,29 +1582,9 @@
Log.v(TAG, "updateSessionLocked(): id=" + id + ", bounds=" + bounds
+ ", value=" + value + ", action=" + action + ", flags=" + flags);
}
- boolean restartIfNecessary = (flags & FLAG_MANUAL_REQUEST) != 0;
-
try {
- if (restartIfNecessary) {
- final AutofillClient client = getClient();
- if (client == null) return; // NOTE: getClient() already logd it..
-
- final int newId = mService.updateOrRestartSession(
- client.autofillClientGetActivityToken(),
- mServiceClient.asBinder(), id, bounds, value, mContext.getUserId(),
- mCallback != null, flags, client.autofillClientGetComponentName(),
- mSessionId, action, isCompatibilityModeEnabledLocked());
- if (newId != mSessionId) {
- if (sDebug) Log.d(TAG, "Session restarted: " + mSessionId + "=>" + newId);
- mSessionId = newId;
- mState = (mSessionId == NO_SESSION) ? STATE_UNKNOWN : STATE_ACTIVE;
- client.autofillClientResetableStateAvailable();
- }
- } else {
- mService.updateSession(mSessionId, id, bounds, value, action, flags,
- mContext.getUserId());
- }
-
+ mService.updateSession(mSessionId, id, bounds, value, action, flags,
+ mContext.getUserId());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/view/autofill/IAutoFillManager.aidl b/core/java/android/view/autofill/IAutoFillManager.aidl
index 176df73..738ff4d 100644
--- a/core/java/android/view/autofill/IAutoFillManager.aidl
+++ b/core/java/android/view/autofill/IAutoFillManager.aidl
@@ -45,10 +45,6 @@
boolean restoreSession(int sessionId, in IBinder activityToken, in IBinder appCallback);
void updateSession(int sessionId, in AutofillId id, in Rect bounds,
in AutofillValue value, int action, int flags, int userId);
- int updateOrRestartSession(IBinder activityToken, in IBinder appCallback,
- in AutofillId autoFillId, in Rect bounds, in AutofillValue value, int userId,
- boolean hasCallback, int flags, in ComponentName componentName, int sessionId,
- int action, boolean compatMode);
void setAutofillFailure(int sessionId, in List<AutofillId> ids, int userId);
void finishSession(int sessionId, int userId);
void cancelSession(int sessionId, int userId);
diff --git a/core/java/android/widget/DateTimeView.java b/core/java/android/widget/DateTimeView.java
index a22f345..621a745 100644
--- a/core/java/android/widget/DateTimeView.java
+++ b/core/java/android/widget/DateTimeView.java
@@ -450,8 +450,10 @@
public void removeView(DateTimeView v) {
synchronized (mAttachedViews) {
- mAttachedViews.remove(v);
- if (mAttachedViews.isEmpty()) {
+ final boolean removed = mAttachedViews.remove(v);
+ // Only unregister once when we remove the last view in the list otherwise we risk
+ // trying to unregister a receiver that is no longer registered.
+ if (removed && mAttachedViews.isEmpty()) {
unregister(getApplicationContextIfAvailable(v.getContext()));
}
}
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index d07721a..058736a 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -4930,6 +4930,7 @@
protected final void dismissMagnifier() {
if (mMagnifierAnimator != null) {
+ mMagnifierAnimator.mMagnifier.setOnOperationCompleteCallback(null);
mMagnifierAnimator.dismiss();
mRenderCursorRegardlessTiming = false;
resumeBlink();
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 4865dab..22c840b 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -68,7 +68,7 @@
import android.widget.AdapterView.OnItemClickListener;
import com.android.internal.R;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.internal.util.Preconditions;
import java.lang.annotation.ElementType;
@@ -2155,7 +2155,7 @@
View v = viewsToProcess.pop();
if (v instanceof TextView) {
TextView textView = (TextView) v;
- textView.setText(NotificationColorUtil.clearColorSpans(textView.getText()));
+ textView.setText(ContrastColorUtil.clearColorSpans(textView.getText()));
textView.setTextColor(textColor);
}
if (v instanceof ViewGroup) {
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index c63edaf..ac7dc8e2 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -2031,7 +2031,7 @@
* Do this in onKeyUp since the Search key is also used for
* chording quick launch shortcuts.
*/
- if (getKeyguardManager().inKeyguardRestrictedInputMode()) {
+ if (isNotInstantAppAndKeyguardRestricted()) {
break;
}
if ((getContext().getResources().getConfiguration().uiMode
@@ -2055,6 +2055,11 @@
return false;
}
+ private boolean isNotInstantAppAndKeyguardRestricted() {
+ return !getContext().getPackageManager().isInstantApp()
+ && getKeyguardManager().inKeyguardRestrictedInputMode();
+ }
+
@Override
protected void onActive() {
}
diff --git a/core/java/com/android/internal/util/NotificationColorUtil.java b/core/java/com/android/internal/util/ContrastColorUtil.java
similarity index 97%
rename from core/java/com/android/internal/util/NotificationColorUtil.java
rename to core/java/com/android/internal/util/ContrastColorUtil.java
index 318bccf..60dd86b 100644
--- a/core/java/com/android/internal/util/NotificationColorUtil.java
+++ b/core/java/com/android/internal/util/ContrastColorUtil.java
@@ -48,13 +48,13 @@
*
* @hide
*/
-public class NotificationColorUtil {
+public class ContrastColorUtil {
- private static final String TAG = "NotificationColorUtil";
+ private static final String TAG = "ContrastColorUtil";
private static final boolean DEBUG = false;
private static final Object sLock = new Object();
- private static NotificationColorUtil sInstance;
+ private static ContrastColorUtil sInstance;
private final ImageUtils mImageUtils = new ImageUtils();
private final WeakHashMap<Bitmap, Pair<Boolean, Integer>> mGrayscaleBitmapCache =
@@ -62,16 +62,16 @@
private final int mGrayscaleIconMaxSize; // @dimen/notification_large_icon_width (64dp)
- public static NotificationColorUtil getInstance(Context context) {
+ public static ContrastColorUtil getInstance(Context context) {
synchronized (sLock) {
if (sInstance == null) {
- sInstance = new NotificationColorUtil(context);
+ sInstance = new ContrastColorUtil(context);
}
return sInstance;
}
}
- private NotificationColorUtil(Context context) {
+ private ContrastColorUtil(Context context) {
mGrayscaleIconMaxSize = context.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_large_icon_width);
}
@@ -470,7 +470,7 @@
*/
public static int resolveContrastColor(Context context, int notificationColor,
int backgroundColor) {
- return NotificationColorUtil.resolveContrastColor(context, notificationColor,
+ return ContrastColorUtil.resolveContrastColor(context, notificationColor,
backgroundColor, false /* isDark */);
}
@@ -489,7 +489,7 @@
final int resolvedColor = resolveColor(context, notificationColor);
int color = resolvedColor;
- color = NotificationColorUtil.ensureTextContrast(color, backgroundColor, isDark);
+ color = ContrastColorUtil.ensureTextContrast(color, backgroundColor, isDark);
if (color != resolvedColor) {
if (DEBUG){
@@ -497,7 +497,7 @@
"Enhanced contrast of notification for %s"
+ " and %s (over background) by changing #%s to %s",
context.getPackageName(),
- NotificationColorUtil.contrastChange(resolvedColor, color, backgroundColor),
+ ContrastColorUtil.contrastChange(resolvedColor, color, backgroundColor),
Integer.toHexString(resolvedColor), Integer.toHexString(color)));
}
}
@@ -523,7 +523,7 @@
final int resolvedColor = resolveColor(context, notificationColor);
int color = resolvedColor;
- color = NotificationColorUtil.ensureTextContrastOnBlack(color);
+ color = ContrastColorUtil.ensureTextContrastOnBlack(color);
if (color != resolvedColor) {
if (DEBUG){
@@ -531,7 +531,7 @@
"Ambient contrast of notification for %s is %s (over black)"
+ " by changing #%s to #%s",
context.getPackageName(),
- NotificationColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
+ ContrastColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
Integer.toHexString(resolvedColor), Integer.toHexString(color)));
}
}
@@ -609,7 +609,7 @@
}
public static boolean satisfiesTextContrast(int backgroundColor, int foregroundColor) {
- return NotificationColorUtil.calculateContrast(foregroundColor, backgroundColor) >= 4.5;
+ return ContrastColorUtil.calculateContrast(foregroundColor, backgroundColor) >= 4.5;
}
/**
diff --git a/core/java/com/android/internal/widget/MessagingLayout.java b/core/java/com/android/internal/widget/MessagingLayout.java
index 0fd6109..514874b 100644
--- a/core/java/com/android/internal/widget/MessagingLayout.java
+++ b/core/java/com/android/internal/widget/MessagingLayout.java
@@ -45,7 +45,7 @@
import com.android.internal.R;
import com.android.internal.graphics.ColorUtils;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import java.util.ArrayList;
import java.util.List;
@@ -315,13 +315,13 @@
}
private int findColor(CharSequence senderName, int layoutColor) {
- double luminance = NotificationColorUtil.calculateLuminance(layoutColor);
+ double luminance = ContrastColorUtil.calculateLuminance(layoutColor);
float shift = Math.abs(senderName.hashCode()) % 5 / 4.0f - 0.5f;
// we need to offset the range if the luminance is too close to the borders
shift += Math.max(COLOR_SHIFT_AMOUNT / 2.0f / 100 - luminance, 0);
shift -= Math.max(COLOR_SHIFT_AMOUNT / 2.0f / 100 - (1.0f - luminance), 0);
- return NotificationColorUtil.getShiftedColor(layoutColor,
+ return ContrastColorUtil.getShiftedColor(layoutColor,
(int) (shift * COLOR_SHIFT_AMOUNT));
}
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index 5847033..4ee951a 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -32,6 +32,7 @@
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.WindowInsets;
import android.view.WindowManagerPolicyConstants.PointerEventListener;
import android.view.MotionEvent.PointerCoords;
@@ -120,6 +121,7 @@
private final Paint mPathPaint;
private final FontMetricsInt mTextMetrics = new FontMetricsInt();
private int mHeaderBottom;
+ private int mHeaderPaddingTop = 0;
private boolean mCurDown;
private int mCurNumPointers;
private int mMaxNumPointers;
@@ -189,12 +191,22 @@
public void setPrintCoords(boolean state) {
mPrintCoords = state;
}
-
+
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ if (insets.getDisplayCutout() != null) {
+ mHeaderPaddingTop = insets.getDisplayCutout().getSafeInsetTop();
+ } else {
+ mHeaderPaddingTop = 0;
+ }
+ return super.onApplyWindowInsets(insets);
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mTextPaint.getFontMetricsInt(mTextMetrics);
- mHeaderBottom = -mTextMetrics.ascent+mTextMetrics.descent+2;
+ mHeaderBottom = mHeaderPaddingTop-mTextMetrics.ascent+mTextMetrics.descent+2;
if (false) {
Log.i("foo", "Metrics: ascent=" + mTextMetrics.ascent
+ " descent=" + mTextMetrics.descent
@@ -223,7 +235,7 @@
protected void onDraw(Canvas canvas) {
final int w = getWidth();
final int itemW = w/7;
- final int base = -mTextMetrics.ascent+1;
+ final int base = mHeaderPaddingTop-mTextMetrics.ascent+1;
final int bottom = mHeaderBottom;
final int NP = mPointers.size();
@@ -232,7 +244,7 @@
if (mActivePointerId >= 0) {
final PointerState ps = mPointers.get(mActivePointerId);
- canvas.drawRect(0, 0, itemW-1, bottom,mTextBackgroundPaint);
+ canvas.drawRect(0, mHeaderPaddingTop, itemW-1, bottom,mTextBackgroundPaint);
canvas.drawText(mText.clear()
.append("P: ").append(mCurNumPointers)
.append(" / ").append(mMaxNumPointers)
@@ -240,24 +252,26 @@
final int N = ps.mTraceCount;
if ((mCurDown && ps.mCurDown) || N == 0) {
- canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom, mTextBackgroundPaint);
+ canvas.drawRect(itemW, mHeaderPaddingTop, (itemW * 2) - 1, bottom,
+ mTextBackgroundPaint);
canvas.drawText(mText.clear()
.append("X: ").append(ps.mCoords.x, 1)
.toString(), 1 + itemW, base, mTextPaint);
- canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom, mTextBackgroundPaint);
+ canvas.drawRect(itemW * 2, mHeaderPaddingTop, (itemW * 3) - 1, bottom,
+ mTextBackgroundPaint);
canvas.drawText(mText.clear()
.append("Y: ").append(ps.mCoords.y, 1)
.toString(), 1 + itemW * 2, base, mTextPaint);
} else {
float dx = ps.mTraceX[N - 1] - ps.mTraceX[0];
float dy = ps.mTraceY[N - 1] - ps.mTraceY[0];
- canvas.drawRect(itemW, 0, (itemW * 2) - 1, bottom,
+ canvas.drawRect(itemW, mHeaderPaddingTop, (itemW * 2) - 1, bottom,
Math.abs(dx) < mVC.getScaledTouchSlop()
? mTextBackgroundPaint : mTextLevelPaint);
canvas.drawText(mText.clear()
.append("dX: ").append(dx, 1)
.toString(), 1 + itemW, base, mTextPaint);
- canvas.drawRect(itemW * 2, 0, (itemW * 3) - 1, bottom,
+ canvas.drawRect(itemW * 2, mHeaderPaddingTop, (itemW * 3) - 1, bottom,
Math.abs(dy) < mVC.getScaledTouchSlop()
? mTextBackgroundPaint : mTextLevelPaint);
canvas.drawText(mText.clear()
@@ -265,26 +279,29 @@
.toString(), 1 + itemW * 2, base, mTextPaint);
}
- canvas.drawRect(itemW * 3, 0, (itemW * 4) - 1, bottom, mTextBackgroundPaint);
+ canvas.drawRect(itemW * 3, mHeaderPaddingTop, (itemW * 4) - 1, bottom,
+ mTextBackgroundPaint);
canvas.drawText(mText.clear()
.append("Xv: ").append(ps.mXVelocity, 3)
.toString(), 1 + itemW * 3, base, mTextPaint);
- canvas.drawRect(itemW * 4, 0, (itemW * 5) - 1, bottom, mTextBackgroundPaint);
+ canvas.drawRect(itemW * 4, mHeaderPaddingTop, (itemW * 5) - 1, bottom,
+ mTextBackgroundPaint);
canvas.drawText(mText.clear()
.append("Yv: ").append(ps.mYVelocity, 3)
.toString(), 1 + itemW * 4, base, mTextPaint);
- canvas.drawRect(itemW * 5, 0, (itemW * 6) - 1, bottom, mTextBackgroundPaint);
- canvas.drawRect(itemW * 5, 0, (itemW * 5) + (ps.mCoords.pressure * itemW) - 1,
- bottom, mTextLevelPaint);
+ canvas.drawRect(itemW * 5, mHeaderPaddingTop, (itemW * 6) - 1, bottom,
+ mTextBackgroundPaint);
+ canvas.drawRect(itemW * 5, mHeaderPaddingTop,
+ (itemW * 5) + (ps.mCoords.pressure * itemW) - 1, bottom, mTextLevelPaint);
canvas.drawText(mText.clear()
.append("Prs: ").append(ps.mCoords.pressure, 2)
.toString(), 1 + itemW * 5, base, mTextPaint);
- canvas.drawRect(itemW * 6, 0, w, bottom, mTextBackgroundPaint);
- canvas.drawRect(itemW * 6, 0, (itemW * 6) + (ps.mCoords.size * itemW) - 1,
- bottom, mTextLevelPaint);
+ canvas.drawRect(itemW * 6, mHeaderPaddingTop, w, bottom, mTextBackgroundPaint);
+ canvas.drawRect(itemW * 6, mHeaderPaddingTop,
+ (itemW * 6) + (ps.mCoords.size * itemW) - 1, bottom, mTextLevelPaint);
canvas.drawText(mText.clear()
.append("Size: ").append(ps.mCoords.size, 2)
.toString(), 1 + itemW * 6, base, mTextPaint);
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index e784de9..bd2a8de 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -915,10 +915,13 @@
}
// Native bridge library. "0" means that native bridge is disabled.
+ //
+ // Note: bridging is only enabled for the zygote. Other runs of
+ // app_process may not have the permissions to mount etc.
property_get("ro.dalvik.vm.native.bridge", propBuf, "");
if (propBuf[0] == '\0') {
ALOGW("ro.dalvik.vm.native.bridge is not expected to be empty");
- } else if (strcmp(propBuf, "0") != 0) {
+ } else if (zygote && strcmp(propBuf, "0") != 0) {
snprintf(nativeBridgeLibrary, sizeof("-XX:NativeBridge=") + PROPERTY_VALUE_MAX,
"-XX:NativeBridge=%s", propBuf);
addOption(nativeBridgeLibrary);
diff --git a/core/jni/android_text_StaticLayout.cpp b/core/jni/android_text_StaticLayout.cpp
index 682dc873..ad84858 100644
--- a/core/jni/android_text_StaticLayout.cpp
+++ b/core/jni/android_text_StaticLayout.cpp
@@ -69,15 +69,12 @@
// set text and set a number of parameters for creating a layout (width, tabstops, strategy,
// hyphenFrequency)
static jlong nInit(JNIEnv* env, jclass /* unused */,
- jint breakStrategy, jint hyphenationFrequency, jboolean isJustified,
- jintArray indents, jintArray leftPaddings, jintArray rightPaddings) {
+ jint breakStrategy, jint hyphenationFrequency, jboolean isJustified, jintArray indents) {
return reinterpret_cast<jlong>(new minikin::android::StaticLayoutNative(
static_cast<minikin::BreakStrategy>(breakStrategy),
static_cast<minikin::HyphenationFrequency>(hyphenationFrequency),
isJustified,
- jintArrayToFloatVector(env, indents),
- jintArrayToFloatVector(env, leftPaddings),
- jintArrayToFloatVector(env, rightPaddings)));
+ jintArrayToFloatVector(env, indents)));
}
// CriticalNative
@@ -161,8 +158,6 @@
"I" // hyphenationFrequency
"Z" // isJustified
"[I" // indents
- "[I" // left paddings
- "[I" // right paddings
")J", (void*) nInit},
// Critical Natives
diff --git a/core/proto/android/providers/settings/global.proto b/core/proto/android/providers/settings/global.proto
index 99f3034..04e5658 100644
--- a/core/proto/android/providers/settings/global.proto
+++ b/core/proto/android/providers/settings/global.proto
@@ -600,14 +600,17 @@
}
optional Ntp ntp = 84;
- // Details about the User Absent, Radios Off feature.
- message UserAbsentRadiosOff {
+ // Details about the User Absent For Small Battery feature.
+ message UserAbsentSmallBattery {
option (android.msg_privacy).dest = DEST_EXPLICIT;
- // Whether or not to enable the User Absent, Radios Off feature on small battery devices.
- optional SettingProto enabled_for_small_battery = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+ // Whether or not to enable the User Absent, Radios Off feature
+ optional SettingProto radios_off_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ];
+
+ // Whether or not to enable the User Absent, Touch Off feature
+ optional SettingProto touch_off_enabled = 2 [ (android.privacy).dest = DEST_AUTOMATIC ];
}
- optional UserAbsentRadiosOff user_absent_radios_off = 85;
+ optional UserAbsentSmallBattery user_absent_small_battery = 85;
// Whether to disable the automatic scheduling of system updates.
optional SettingProto ota_disable_automatic_update = 86 [ (android.privacy).dest = DEST_AUTOMATIC ];
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 1b41f99..e33ecb8 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -843,6 +843,19 @@
android:description="@string/permdesc_accessCoarseLocation"
android:protectionLevel="dangerous|instant" />
+ <!-- Allows an app to access location in the background. If you
+ are requesting this, you should also request {@link #ACCESS_FINE_LOCATION}.
+ Requesting this by itself is not sufficient to give you
+ location access.
+ <p>Protection level: dangerous
+ @hide
+ -->
+ <permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"
+ android:permissionGroup="android.permission-group.LOCATION"
+ android:label="@string/permlab_accessBackgroundLocation"
+ android:description="@string/permdesc_accessBackgroundLocation"
+ android:protectionLevel="dangerous|instant" />
+
<!-- ====================================================================== -->
<!-- Permissions for accessing the call log -->
<!-- ====================================================================== -->
@@ -3024,15 +3037,6 @@
<permission android:name="android.permission.INSTALL_PACKAGE_UPDATES"
android:protectionLevel="signature|privileged" />
- <!-- Allows an application to install existing system packages. This is a limited
- version of {@link android.Manifest.permission#INSTALL_PACKAGES}.
- <p>Not for use by third-party applications.
- TODO(b/80204953): remove this permission once we have a long-term solution.
- @hide
- -->
- <permission android:name="com.android.permission.INSTALL_EXISTING_PACKAGES"
- android:protectionLevel="signature|privileged" />
-
<!-- @SystemApi Allows an application to clear user data.
<p>Not for use by third-party applications
@hide
diff --git a/core/res/res/drawable-watch/toast_frame.xml b/core/res/res/drawable-watch/toast_frame.xml
new file mode 100644
index 0000000..60129a2
--- /dev/null
+++ b/core/res/res/drawable-watch/toast_frame.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* Copyright 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.
+*/
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <!-- background is material_grey_700 with .9 alpha -->
+ <solid android:color="#E65F6368" />
+ <corners android:radius="24dp" />
+</shape>
+
diff --git a/core/res/res/layout-watch/transient_notification.xml b/core/res/res/layout-watch/transient_notification.xml
new file mode 100644
index 0000000..aeae699
--- /dev/null
+++ b/core/res/res/layout-watch/transient_notification.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingHorizontal="@dimen/screen_percentage_05"
+ android:orientation="vertical">
+ <TextView
+ android:id="@android:id/message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:minHeight="48dp"
+ android:paddingHorizontal="16dp"
+ android:paddingVertical="8dp"
+ android:gravity="center"
+ android:textAppearance="@style/TextAppearance.Toast"
+ android:background="?android:attr/toastFrameBackground"
+ />
+</LinearLayout>
\ No newline at end of file
diff --git a/core/res/res/values-w210dp-round-watch/styles.xml b/core/res/res/values-w210dp-round-watch/styles.xml
new file mode 100644
index 0000000..f10374c
--- /dev/null
+++ b/core/res/res/values-w210dp-round-watch/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <style name="TextAppearance.Toast">
+ <item name="fontFamily">roboto</item>
+ <item name="textSize">15sp</item>
+ </style>
+</resources>
\ No newline at end of file
diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml
index e12f04a..8e82479 100644
--- a/core/res/res/values-watch/config.xml
+++ b/core/res/res/values-watch/config.xml
@@ -68,4 +68,7 @@
<bool name="config_supportsMultiWindow">true</bool>
<bool name="config_supportsMultiDisplay">true</bool>
<bool name="config_supportsSplitScreenMultiWindow">false</bool>
+
+ <!-- Default Gravity setting for the system Toast view. Equivalent to: Gravity.CENTER -->
+ <integer name="config_toastDefaultGravity">0x00000011</integer>
</resources>
diff --git a/core/res/res/values-watch/dimens.xml b/core/res/res/values-watch/dimens.xml
index 4c8b39c..5472316 100644
--- a/core/res/res/values-watch/dimens.xml
+++ b/core/res/res/values-watch/dimens.xml
@@ -18,4 +18,6 @@
<dimen name="alert_dialog_title_height">0dp</dimen>
<!-- Dialog button bar height, not used in watch due to dynamically sized button bar -->
<dimen name="alert_dialog_button_bar_height">0dp</dimen>
+
+ <dimen name="toast_y_offset">0dip</dimen>
</resources>
diff --git a/core/res/res/values-watch/styles.xml b/core/res/res/values-watch/styles.xml
new file mode 100644
index 0000000..3172f73
--- /dev/null
+++ b/core/res/res/values-watch/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <style name="TextAppearance.Toast">
+ <item name="fontFamily">sans-serif-regular</item>
+ <item name="textSize">13sp</item>
+ </style>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index eb07c28..0b5dd7e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2522,9 +2522,11 @@
property. If this is false, then the following recents config flags are ignored. -->
<bool name="config_hasRecents">true</bool>
- <!-- Component name for the activity that will be presenting the Recents UI, which will receive
- special permissions for API related to fetching and presenting recent tasks. -->
- <string name="config_recentsComponentName" translatable="false">com.android.systemui/.recents.RecentsActivity</string>
+ <!-- Component name for the activity that will be presenting the Recents UI, which will receive special permissions for API related
+ to fetching and presenting recent tasks. The default configuration uses Launcehr3QuickStep as default launcher and points to
+ the corresponding recents component. When using a different default launcher, change this appropriately or use the default
+ systemui implementation: com.android.systemui/.recents.RecentsActivity -->
+ <string name="config_recentsComponentName" translatable="false">com.android.launcher3/com.android.quickstep.RecentsActivity</string>
<!-- The minimum number of visible recent tasks to be presented to the user through the
SystemUI. Can be -1 if there is no minimum limit. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 8f469b0..ac9c9f6 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1082,10 +1082,9 @@
with the operation of the GPS or other location sources.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permlab_accessFineLocation">access precise location (GPS and
- network-based)</string>
+ <string name="permlab_accessFineLocation">access precise only in the foreground</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
- <string name="permdesc_accessFineLocation">This app can get your location based on GPS or network location sources such as cell towers and Wi-Fi networks. These location services must be turned on and available on your phone for the app to be able to use them. This may increase battery consumption.</string>
+ <string name="permdesc_accessFineLocation">This app can get your exact location only when it is in the foreground. These location services must be turned on and available on your phone for the app to be able to use them. This may increase battery consumption.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_accessCoarseLocation">access approximate location
@@ -1097,7 +1096,12 @@
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_accessCoarseLocation" product="default">This app can get your location based on network sources such as cell towers and Wi-Fi networks. These location services must be turned on and available on your phone for the app to be able to use them.</string>
- <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_accessBackgroundLocation">access precise location in the background</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_accessBackgroundLocation">This app can get your exact location any time it is in the background. These location services must be turned on and available on your phone for the app to be able to use them. This may increase battery consumption.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_modifyAudioSettings">change your audio settings</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_modifyAudioSettings">Allows the app to modify global audio settings such as volume and which speaker is used for output.</string>
diff --git a/core/tests/coretests/src/android/app/NotificationTest.java b/core/tests/coretests/src/android/app/NotificationTest.java
index 9ab7544..e1cb911 100644
--- a/core/tests/coretests/src/android/app/NotificationTest.java
+++ b/core/tests/coretests/src/android/app/NotificationTest.java
@@ -16,7 +16,7 @@
package android.app;
-import static com.android.internal.util.NotificationColorUtil.satisfiesTextContrast;
+import static com.android.internal.util.ContrastColorUtil.satisfiesTextContrast;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/core/tests/coretests/src/android/provider/DocumentsProviderTest.java b/core/tests/coretests/src/android/provider/DocumentsProviderTest.java
index 09cbbff..1465d0a9 100644
--- a/core/tests/coretests/src/android/provider/DocumentsProviderTest.java
+++ b/core/tests/coretests/src/android/provider/DocumentsProviderTest.java
@@ -24,7 +24,6 @@
import android.test.ProviderTestCase2;
import java.util.Arrays;
-import java.util.List;
/**
* Unit tests for {@link DocumentsProvider}.
@@ -84,7 +83,10 @@
final Uri docUri = buildTreeDocumentUri(
TestDocumentsProvider.AUTHORITY, PARENT_DOCUMENT_ID, DOCUMENT_ID);
- assertNull(DocumentsContract.findDocumentPath(mResolver, docUri));
+ try {
+ DocumentsContract.findDocumentPath(mResolver, docUri);
+ fail("Expected a SecurityException to be throw");
+ } catch (SecurityException expected) { }
}
public void testFindDocumentPath_treeUri_erasesNonNullRootId() throws Exception {
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 062ac66..7428b12 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -176,7 +176,6 @@
Settings.Global.CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS,
Settings.Global.CONTACT_METADATA_SYNC_ENABLED,
Settings.Global.CONTACTS_DATABASE_WAL_ENABLED,
- Settings.Global.CPU_SCALING_ENABLED,
Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI,
Settings.Global.DATABASE_CREATION_BUILDID,
@@ -341,7 +340,6 @@
Settings.Global.NTP_SERVER,
Settings.Global.NTP_TIMEOUT,
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,
- Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
Settings.Global.OVERLAY_DISPLAY_DEVICES,
Settings.Global.PAC_CHANGE_DELAY,
Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE,
@@ -403,7 +401,6 @@
Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS,
Settings.Global.STORAGE_BENCHMARK_INTERVAL,
Settings.Global.STORAGE_SETTINGS_CLOBBER_THRESHOLD,
- Settings.Global.SWAP_ENABLED,
Settings.Global.SYNC_MANAGER_CONSTANTS,
Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS,
Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL,
@@ -436,6 +433,8 @@
Settings.Global.UNGAZE_SLEEP_ENABLED,
Settings.Global.UNLOCK_SOUND,
Settings.Global.USE_GOOGLE_MAIL,
+ Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
+ Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
Settings.Global.VT_IMS_ENABLED,
Settings.Global.WAIT_FOR_DEBUGGER,
Settings.Global.ENABLE_GPU_DEBUG_LAYERS,
@@ -444,6 +443,7 @@
Settings.Global.ENABLE_GNSS_RAW_MEAS_FULL_TRACKING,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_PERSISTENT,
Settings.Global.INSTALL_CARRIER_APP_NOTIFICATION_SLEEP_MILLIS,
+ Settings.Global.USER_SWITCHER_ENABLED,
Settings.Global.NETWORK_ACCESS_TIMEOUT_MS,
Settings.Global.WARNING_TEMPERATURE,
Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
diff --git a/core/tests/coretests/src/android/widget/DateTimeViewTest.java b/core/tests/coretests/src/android/widget/DateTimeViewTest.java
new file mode 100644
index 0000000..fbf0d36
--- /dev/null
+++ b/core/tests/coretests/src/android/widget/DateTimeViewTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.widget;
+
+import android.support.test.InstrumentationRegistry;
+import android.support.test.annotation.UiThreadTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class DateTimeViewTest {
+
+ @UiThreadTest
+ @Test
+ public void additionalOnDetachedFromWindow_noException() {
+ final DateTimeView dateTimeView = new DateTimeView(InstrumentationRegistry.getContext());
+ dateTimeView.onAttachedToWindow();
+ dateTimeView.onAttachedToWindow();
+ // Even there is an additional detach (abnormal), DateTimeView should not unregister
+ // receiver again that raises "java.lang.IllegalArgumentException: Receiver not registered".
+ dateTimeView.onDetachedFromWindow();
+ }
+}
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index df84a4c..b3f05dc 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -168,6 +168,7 @@
<assign-permission name="android.permission.DUMP" uid="incidentd" />
<assign-permission name="android.permission.PACKAGE_USAGE_STATS" uid="incidentd" />
+ <assign-permission name="android.permission.INTERACT_ACROSS_USERS" uid="incidentd" />
<assign-permission name="android.permission.ACCESS_LOWPAN_STATE" uid="lowpan" />
<assign-permission name="android.permission.MANAGE_LOWPAN_INTERFACES" uid="lowpan" />
diff --git a/data/sounds/AllAudio.mk b/data/sounds/AllAudio.mk
index edfd380..bf8067c 100644
--- a/data/sounds/AllAudio.mk
+++ b/data/sounds/AllAudio.mk
@@ -232,4 +232,5 @@
$(LOCAL_PATH)/effects/ogg/WirelessChargingStarted.ogg:system/media/audio/ui/WirelessChargingStarted.ogg \
$(LOCAL_PATH)/effects/ogg/camera_click_48k.ogg:system/media/audio/ui/camera_click.ogg \
$(LOCAL_PATH)/effects/ogg/camera_focus.ogg:system/media/audio/ui/camera_focus.ogg \
-
+ $(LOCAL_PATH)/effects/ogg/ChargingStarted.ogg:system/media/audio/ui/ChargingStarted.ogg \
+ $(LOCAL_PATH)/effects/ogg/InCallNotification.ogg:system/media/audio/ui/InCallNotification.ogg \
diff --git a/data/sounds/AudioPackage10.mk b/data/sounds/AudioPackage10.mk
index c5222af..72aa7fe 100644
--- a/data/sounds/AudioPackage10.mk
+++ b/data/sounds/AudioPackage10.mk
@@ -32,6 +32,8 @@
$(LOCAL_PATH)/effects/ogg/Lock_48k.ogg:system/media/audio/ui/Lock.ogg \
$(LOCAL_PATH)/effects/ogg/Unlock_48k.ogg:system/media/audio/ui/Unlock.ogg \
$(LOCAL_PATH)/effects/ogg/Trusted_48k.ogg:system/media/audio/ui/Trusted.ogg \
+ $(LOCAL_PATH)/effects/ogg/ChargingStarted.ogg:system/media/audio/ui/ChargingStarted.ogg \
+ $(LOCAL_PATH)/effects/ogg/InCallNotification.ogg:system/media/audio/ui/InCallNotification.ogg \
$(LOCAL_PATH)/effects/material/ogg/WirelessChargingStarted_48k.ogg:system/media/audio/ui/WirelessChargingStarted.ogg \
$(LOCAL_PATH)/notifications/ogg/Adara.ogg:system/media/audio/notifications/Adara.ogg \
$(LOCAL_PATH)/notifications/ogg/Alya.ogg:system/media/audio/notifications/Alya.ogg \
diff --git a/data/sounds/AudioPackage11.mk b/data/sounds/AudioPackage11.mk
index 43c83b9..665ce52 100644
--- a/data/sounds/AudioPackage11.mk
+++ b/data/sounds/AudioPackage11.mk
@@ -32,6 +32,8 @@
$(LOCAL_PATH)/effects/ogg/Lock_48k.ogg:system/media/audio/ui/Lock.ogg \
$(LOCAL_PATH)/effects/ogg/Unlock_48k.ogg:system/media/audio/ui/Unlock.ogg \
$(LOCAL_PATH)/effects/ogg/Trusted_48k.ogg:system/media/audio/ui/Trusted.ogg \
+ $(LOCAL_PATH)/effects/ogg/ChargingStarted.ogg:system/media/audio/ui/ChargingStarted.ogg \.
+ $(LOCAL_PATH)/effects/ogg/InCallNotification.ogg:system/media/audio/ui/InCallNotification.ogg \
$(LOCAL_PATH)/effects/material/ogg/WirelessChargingStarted_48k.ogg:system/media/audio/ui/WirelessChargingStarted.ogg \
$(LOCAL_PATH)/notifications/ogg/Adara.ogg:system/media/audio/notifications/Adara.ogg \
$(LOCAL_PATH)/notifications/ogg/Alya.ogg:system/media/audio/notifications/Alya.ogg \
diff --git a/data/sounds/AudioPackage12.mk b/data/sounds/AudioPackage12.mk
index cd4d35b..44a8f9e 100644
--- a/data/sounds/AudioPackage12.mk
+++ b/data/sounds/AudioPackage12.mk
@@ -12,7 +12,7 @@
NOTIFICATION_FILES := Ariel Ceres Carme Elara Europa Iapetus Io Rhea Salacia Titan Tethys
RINGTONE_FILES := Callisto Dione Ganymede Luna Oberon Phobos Sedna Titania Triton Umbriel
EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
- camera_focus Dock Undock Lock Unlock Trusted
+ camera_focus Dock Undock Lock Unlock Trusted ChargingStarted InCallNotification
MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted VideoStop
PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
diff --git a/data/sounds/AudioPackage12_48.mk b/data/sounds/AudioPackage12_48.mk
index 80758f4..09fab04 100644
--- a/data/sounds/AudioPackage12_48.mk
+++ b/data/sounds/AudioPackage12_48.mk
@@ -12,7 +12,7 @@
NOTIFICATION_FILES := Ariel Ceres Carme Elara Europa Iapetus Io Rhea Salacia Titan Tethys
RINGTONE_FILES := Callisto Dione Ganymede Luna Oberon Phobos Sedna Titania Triton Umbriel
EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
- Lock Unlock Trusted
+ Lock Unlock Trusted ChargingStarted InCallNotification
MATERIAL_EFFECT_FILES := camera_click VideoRecord LowBattery WirelessChargingStarted VideoStop
# Alarms not yet available in 48 kHz
diff --git a/data/sounds/AudioPackage13.mk b/data/sounds/AudioPackage13.mk
index d33a4af..de4ee04 100644
--- a/data/sounds/AudioPackage13.mk
+++ b/data/sounds/AudioPackage13.mk
@@ -13,7 +13,7 @@
RINGTONE_FILES := Atria Callisto Dione Ganymede Luna Oberon Phobos Pyxis Sedna Titania Triton \
Umbriel
EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
- camera_focus Dock Undock Lock Unlock Trusted
+ camera_focus Dock Undock Lock Unlock Trusted ChargingStarted InCallNotification
MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery VideoStop
PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
diff --git a/data/sounds/AudioPackage13_48.mk b/data/sounds/AudioPackage13_48.mk
index 9c320ae..889d581 100644
--- a/data/sounds/AudioPackage13_48.mk
+++ b/data/sounds/AudioPackage13_48.mk
@@ -13,7 +13,7 @@
RINGTONE_FILES := Atria Callisto Dione Ganymede Luna Oberon Phobos Pyxis Sedna Titania Triton \
Umbriel
EFFECT_FILES := Effect_Tick KeypressReturn KeypressInvalid KeypressDelete KeypressSpacebar KeypressStandard \
- Lock Unlock Trusted
+ Lock Unlock Trusted ChargingStarted InCallNotification
MATERIAL_EFFECT_FILES := camera_click VideoRecord WirelessChargingStarted LowBattery VideoStop
PRODUCT_COPY_FILES += $(foreach fn,$(ALARM_FILES),\
diff --git a/data/sounds/effects/ChargingStarted.ogg b/data/sounds/effects/ChargingStarted.ogg
new file mode 100644
index 0000000..f09e273
--- /dev/null
+++ b/data/sounds/effects/ChargingStarted.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/ChargingStarted.ogg b/data/sounds/effects/ogg/ChargingStarted.ogg
new file mode 100644
index 0000000..f09e273
--- /dev/null
+++ b/data/sounds/effects/ogg/ChargingStarted.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/ChargingStarted_48k.ogg b/data/sounds/effects/ogg/ChargingStarted_48k.ogg
new file mode 100644
index 0000000..f09e273
--- /dev/null
+++ b/data/sounds/effects/ogg/ChargingStarted_48k.ogg
Binary files differ
diff --git a/data/sounds/effects/ogg/InCallNotification_48k.ogg b/data/sounds/effects/ogg/InCallNotification_48k.ogg
new file mode 100644
index 0000000..4481ccb2
--- /dev/null
+++ b/data/sounds/effects/ogg/InCallNotification_48k.ogg
Binary files differ
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index b644cc3..861dc0f 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -6824,8 +6824,16 @@
}
} else if (ctype == RES_TABLE_LIBRARY_TYPE) {
+
if (group->dynamicRefTable.entries().size() == 0) {
- status_t err = group->dynamicRefTable.load((const ResTable_lib_header*) chunk);
+ const ResTable_lib_header* lib = (const ResTable_lib_header*) chunk;
+ status_t err = validate_chunk(&lib->header, sizeof(*lib),
+ endPos, "ResTable_lib_header");
+ if (err != NO_ERROR) {
+ return (mError=err);
+ }
+
+ err = group->dynamicRefTable.load(lib);
if (err != NO_ERROR) {
return (mError=err);
}
diff --git a/media/java/android/media/MediaTimestamp.java b/media/java/android/media/MediaTimestamp.java
index dd43b4e..e079a8e 100644
--- a/media/java/android/media/MediaTimestamp.java
+++ b/media/java/android/media/MediaTimestamp.java
@@ -51,8 +51,18 @@
/**
* Get the {@link java.lang.System#nanoTime system time} corresponding to the media time
* in nanoseconds.
+ * @deprecated use {@link #getAnchorSystemNanoTime} instead.
*/
+ @Deprecated
public long getAnchorSytemNanoTime() {
+ return getAnchorSystemNanoTime();
+ }
+
+ /**
+ * Get the {@link java.lang.System#nanoTime system time} corresponding to the media time
+ * in nanoseconds.
+ */
+ public long getAnchorSystemNanoTime() {
return nanoTime;
}
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
index f8f7a90..031e373 100644
--- a/media/jni/android_media_ImageWriter.cpp
+++ b/media/jni/android_media_ImageWriter.cpp
@@ -252,7 +252,14 @@
* after disconnect. MEDIA or CAMERA are treated the same internally. The producer listener
* will be cleared after disconnect call.
*/
- producer->connect(/*api*/NATIVE_WINDOW_API_CAMERA, /*listener*/ctx);
+ res = producer->connect(/*api*/NATIVE_WINDOW_API_CAMERA, /*listener*/ctx);
+ if (res != OK) {
+ ALOGE("%s: Connecting to surface producer interface failed: %s (%d)",
+ __FUNCTION__, strerror(-res), res);
+ jniThrowRuntimeException(env, "Failed to connect to native window");
+ return 0;
+ }
+
jlong nativeCtx = reinterpret_cast<jlong>(ctx.get());
// Get the dimension and format of the producer.
diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml
index 72e37ed..9ecaa03 100644
--- a/packages/CaptivePortalLogin/AndroidManifest.xml
+++ b/packages/CaptivePortalLogin/AndroidManifest.xml
@@ -22,8 +22,8 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
- <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
<uses-permission android:name="android.permission.NETWORK_BYPASS_PRIVATE_DNS" />
+ <uses-permission android:name="android.permission.NETWORK_SETTINGS" />
<application android:label="@string/app_name"
android:usesCleartextTraffic="true">
diff --git a/packages/SettingsLib/res/layout/preference_dropdown_material_settings.xml b/packages/SettingsLib/res/layout/preference_dropdown_material_settings.xml
deleted file mode 100644
index a0b8155..0000000
--- a/packages/SettingsLib/res/layout/preference_dropdown_material_settings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2017 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-
-<!-- Based off frameworks/base/core/res/res/layout/preference_dropdown_material.xml
- except that icon space in this layout is always reserved -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Spinner
- android:id="@+id/spinner"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/preference_no_icon_padding_start"
- android:visibility="invisible" />
-
- <include layout="@layout/preference_material"/>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/packages/SettingsLib/res/values/styles_support_preference.xml b/packages/SettingsLib/res/values/styles_support_preference.xml
index 59de6c9..6e61196 100644
--- a/packages/SettingsLib/res/values/styles_support_preference.xml
+++ b/packages/SettingsLib/res/values/styles_support_preference.xml
@@ -20,82 +20,14 @@
<dimen name="preference_no_icon_padding_start">72dp</dimen>
- <!-- Fragment style -->
- <style name="PreferenceFragmentStyle.SettingsBase" parent="@*android:style/PreferenceFragment.Material">
- <item name="allowDividerAfterLastItem">false</item>
- </style>
-
- <!-- Preferences -->
- <style name="Preference.SettingsBase" parent="@style/Preference.Material">
- <item name="allowDividerAbove">false</item>
- <item name="allowDividerBelow">true</item>
- <item name="singleLineTitle">false</item>
- <item name="iconSpaceReserved">true</item>
- </style>
-
- <!-- Preference category -->
- <style name="Preference.Category.SettingsBase" parent="@style/Preference.Category.Material">
- <item name="allowDividerAbove">true</item>
- <item name="allowDividerBelow">true</item>
- <item name="android:layout">@layout/preference_category_material_settings</item>
- </style>
-
- <!-- Preference screen -->
- <style name="Preference.Screen.SettingsBase" parent="@style/Preference.PreferenceScreen.Material">
- <item name="allowDividerAbove">false</item>
- <item name="allowDividerBelow">true</item>
- <item name="iconSpaceReserved">true</item>
- </style>
-
<!-- Footer Preferences -->
- <style name="Preference.FooterPreference.SettingsBase" parent="Preference.SettingsBase">
+ <style name="Preference.FooterPreference.SettingsBase" parent="@style/Preference.Material">
<item name="android:layout">@layout/preference_footer</item>
<item name="allowDividerAbove">true</item>
</style>
- <!-- Dropdown Preferences -->
- <style name="Preference.DropdownPreference.SettingsBase" parent="Preference.SettingsBase">
- <item name="android:layout">@layout/preference_dropdown_material_settings</item>
- </style>
-
- <!-- Switch Preferences -->
- <style name="Preference.SwitchPreference.SettingsBase" parent="@style/Preference.SwitchPreference.Material">
- <item name="allowDividerAbove">false</item>
- <item name="allowDividerBelow">true</item>
- <item name="iconSpaceReserved">true</item>
- <item name="singleLineTitle">false</item>
- </style>
-
- <!-- CheckBox Preferences -->
- <style name="Preference.CheckBoxPreference.SettingsBase" parent="@style/Preference.CheckBoxPreference.Material">
- <item name="allowDividerAbove">false</item>
- <item name="allowDividerBelow">true</item>
- <item name="iconSpaceReserved">true</item>
- <item name="singleLineTitle">false</item>
- </style>
-
- <!-- EditText Preferences -->
- <style name="Preference.EditTextPreference.SettingsBase"
- parent="@style/Preference.DialogPreference.EditTextPreference.Material">
- <item name="allowDividerAbove">false</item>
- <item name="allowDividerBelow">true</item>
- <item name="iconSpaceReserved">true</item>
- <item name="singleLineTitle">false</item>
- </style>
-
- <style name="PreferenceThemeOverlay.SettingsBase" parent="@style/PreferenceThemeOverlay.v14.Material">
- <!-- Parent path frameworks/support/v14/preference/res/values/themes.xml -->
- <item name="android:scrollbars">vertical</item>
- <item name="preferenceFragmentStyle">@style/PreferenceFragmentStyle.SettingsBase</item>
- <item name="preferenceCategoryStyle">@style/Preference.Category.SettingsBase</item>
- <item name="preferenceScreenStyle">@style/Preference.Screen.SettingsBase</item>
- <item name="preferenceStyle">@style/Preference.SettingsBase</item>
- <item name="dialogPreferenceStyle">@style/Preference.SettingsBase</item>
- <item name="editTextPreferenceStyle">@style/Preference.EditTextPreference.SettingsBase</item>
+ <style name="PreferenceThemeOverlay.SettingsBase" parent="@style/PreferenceThemeOverlay">
<item name="footerPreferenceStyle">@style/Preference.FooterPreference.SettingsBase</item>
- <item name="switchPreferenceStyle">@style/Preference.SwitchPreference.SettingsBase</item>
- <item name="checkBoxPreferenceStyle">@style/Preference.CheckBoxPreference.SettingsBase</item>
- <item name="dropdownPreferenceStyle">@style/Preference.DropdownPreference.SettingsBase</item>
</style>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index a3c1fc6..21bac88 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -22,9 +22,6 @@
import android.app.Application;
import android.app.usage.StorageStats;
import android.app.usage.StorageStatsManager;
-import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.LifecycleObserver;
-import androidx.lifecycle.OnLifecycleEvent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -49,7 +46,6 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
-import androidx.annotation.VisibleForTesting;
import android.text.format.Formatter;
import android.util.IconDrawableFactory;
import android.util.Log;
@@ -62,6 +58,7 @@
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.WeakReference;
import java.text.Collator;
import java.text.Normalizer;
import java.text.Normalizer.Form;
@@ -74,6 +71,11 @@
import java.util.UUID;
import java.util.regex.Pattern;
+import androidx.annotation.VisibleForTesting;
+import androidx.lifecycle.Lifecycle;
+import androidx.lifecycle.LifecycleObserver;
+import androidx.lifecycle.OnLifecycleEvent;
+
/**
* Keeps track of information about all installed applications, lazy-loading
* as needed.
@@ -132,7 +134,7 @@
boolean mSessionsChanged;
// Temporary for dispatching session callbacks. Only touched by main thread.
- final ArrayList<Session> mActiveSessions = new ArrayList<Session>();
+ final ArrayList<WeakReference<Session>> mActiveSessions = new ArrayList<>();
final HandlerThread mThread;
final BackgroundHandler mBackgroundHandler;
@@ -618,7 +620,7 @@
for (int i=0; i<mSessions.size(); i++) {
Session s = mSessions.get(i);
if (s.mResumed) {
- mActiveSessions.add(s);
+ mActiveSessions.add(new WeakReference<>(s));
}
}
}
@@ -830,46 +832,70 @@
rebuildActiveSessions();
switch (msg.what) {
case MSG_REBUILD_COMPLETE: {
- Session s = (Session)msg.obj;
- if (mActiveSessions.contains(s)) {
- s.mCallbacks.onRebuildComplete(s.mLastAppList);
+ Session s = (Session) msg.obj;
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null && session == s) {
+ s.mCallbacks.onRebuildComplete(s.mLastAppList);
+ }
}
} break;
case MSG_PACKAGE_LIST_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageListChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageListChanged();
+ }
}
} break;
case MSG_PACKAGE_ICON_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageIconChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageIconChanged();
+ }
}
} break;
case MSG_PACKAGE_SIZE_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageSizeChanged(
- (String)msg.obj);
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageSizeChanged(
+ (String) msg.obj);
+ }
}
} break;
case MSG_ALL_SIZES_COMPUTED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onAllSizesComputed();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onAllSizesComputed();
+ }
}
} break;
case MSG_RUNNING_STATE_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onRunningStateChanged(
- msg.arg1 != 0);
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onRunningStateChanged(
+ msg.arg1 != 0);
+ }
}
} break;
case MSG_LAUNCHER_INFO_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onLauncherInfoChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onLauncherInfoChanged();
+ }
}
} break;
case MSG_LOAD_ENTRIES_COMPLETE: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onLoadEntriesCompleted();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onLoadEntriesCompleted();
+ }
}
} break;
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
index 3732471..1c50953 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
@@ -19,6 +19,8 @@
import android.content.Context;
import android.util.Log;
+import java.lang.ref.WeakReference;
+
/**
* LocalBluetoothManager provides a simplified interface on top of a subset of
* the Bluetooth API. Note that {@link #getInstance} will return null
@@ -34,7 +36,7 @@
private final Context mContext;
/** If a BT-related activity is in the foreground, this will be it. */
- private Context mForegroundActivity;
+ private WeakReference<Context> mForegroundActivity;
private final LocalBluetoothAdapter mLocalAdapter;
@@ -85,17 +87,19 @@
}
public Context getForegroundActivity() {
- return mForegroundActivity;
+ return mForegroundActivity == null
+ ? null
+ : mForegroundActivity.get();
}
public boolean isForegroundActivity() {
- return mForegroundActivity != null;
+ return mForegroundActivity != null && mForegroundActivity.get() != null;
}
public synchronized void setForegroundActivity(Context context) {
if (context != null) {
Log.d(TAG, "setting foreground activity to non-null context");
- mForegroundActivity = context;
+ mForegroundActivity = new WeakReference<>(context);
} else {
if (mForegroundActivity != null) {
Log.d(TAG, "setting foreground activity to null");
diff --git a/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java b/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
index 988060e..e5d97c9 100644
--- a/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
+++ b/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
@@ -36,12 +36,12 @@
import android.util.Log;
import android.util.Xml;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -97,15 +97,15 @@
}
public DreamBackend(Context context) {
- mContext = context;
+ mContext = context.getApplicationContext();
mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.getService(DreamService.DREAM_SERVICE));
mComparator = new DreamInfoComparator(getDefaultDream());
- mDreamsEnabledByDefault = context.getResources()
+ mDreamsEnabledByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault);
- mDreamsActivatedOnSleepByDefault = context.getResources()
+ mDreamsActivatedOnSleepByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
- mDreamsActivatedOnDockByDefault = context.getResources()
+ mDreamsActivatedOnDockByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
}
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
index 8778ae9..914d182 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/SettingsLibRobolectricTestRunner.java
@@ -54,7 +54,7 @@
final List<ResourcePath> paths = super.getIncludedResourcePaths();
paths.add(resourcePath("file:frameworks/base/packages/SettingsLib/res"));
paths.add(resourcePath("file:frameworks/base/core/res/res"));
- paths.add(resourcePath("file:frameworks/support/v7/appcompat/res"));
+ paths.add(resourcePath("file:frameworks/support/appcompat/res"));
return paths;
}
};
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
index d5efcb5..77eb6c4 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java
@@ -963,11 +963,14 @@
GlobalSettingsProto.Ntp.TIMEOUT_MS);
p.end(ntpToken);
- final long uaroToken = p.start(GlobalSettingsProto.USER_ABSENT_RADIOS_OFF);
+ final long uasbToken = p.start(GlobalSettingsProto.USER_ABSENT_SMALL_BATTERY);
dumpSetting(s, p,
Settings.Global.USER_ABSENT_RADIOS_OFF_FOR_SMALL_BATTERY_ENABLED,
- GlobalSettingsProto.UserAbsentRadiosOff.ENABLED_FOR_SMALL_BATTERY);
- p.end(uaroToken);
+ GlobalSettingsProto.UserAbsentSmallBattery.RADIOS_OFF_ENABLED);
+ dumpSetting(s, p,
+ Settings.Global.USER_ABSENT_TOUCH_OFF_FOR_SMALL_BATTERY_ENABLED,
+ GlobalSettingsProto.UserAbsentSmallBattery.TOUCH_OFF_ENABLED);
+ p.end(uasbToken);
dumpSetting(s, p,
Settings.Global.OTA_DISABLE_AUTOMATIC_UPDATE,
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 960d305..375fef8a 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -3726,17 +3726,7 @@
}
if (currentVersion == 164) {
- // Version 164: show zen upgrade notification
- final SettingsState settings = getGlobalSettingsLocked();
- final Setting currentSetting = settings.getSettingLocked(
- Global.SHOW_ZEN_UPGRADE_NOTIFICATION);
- if (!currentSetting.isNull()
- && TextUtils.equals("0", currentSetting.getValue())) {
- settings.insertSettingLocked(
- Global.SHOW_ZEN_UPGRADE_NOTIFICATION, "1",
- null, true, SettingsState.SYSTEM_PACKAGE_NAME);
- }
-
+ // Version 164: REMOVED: show zen upgrade notification
currentVersion = 165;
}
diff --git a/packages/SystemUI/res/drawable-nodpi/icon.xml b/packages/SystemUI/res/drawable-nodpi/icon.xml
index abafb68..48094c4 100644
--- a/packages/SystemUI/res/drawable-nodpi/icon.xml
+++ b/packages/SystemUI/res/drawable-nodpi/icon.xml
@@ -1,5 +1,5 @@
<!--
-Copyright (C) 2017 The Android Open Source Project
+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.
@@ -13,28 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="48dp"
- android:height="48dp"
- android:viewportWidth="48.0"
- android:viewportHeight="48.0">
- <path
- android:pathData="M25.0,25.0m-20.5,0.0a20.5,20.5,0,1,1,41.0,0.0a20.5,20.5,0,1,1,-41.0,0.0"
- android:fillAlpha="0.066"
- android:fillColor="#000000"/>
- <path
- android:pathData="M24.0,24.0m-20.0,0.0a20.0,20.0,0,1,1,40.0,0.0a20.0,20.0,0,1,1,-40.0,0.0"
- android:fillColor="#FFC107"/>
- <path
- android:pathData="M44,24.2010101 L33.9004889,14.101499 L14.101499,33.9004889 L24.2010101,44 C29.2525804,43.9497929 34.2887564,41.9975027 38.1431296,38.1431296 C41.9975027,34.2887564 43.9497929,29.2525804 44,24.2010101 Z"
- android:fillColor="#FE9F00"/>
- <path
- android:pathData="M24.0,24.0m-14.0,0.0a14.0,14.0,0,1,1,28.0,0.0a14.0,14.0,0,1,1,-28.0,0.0"
- android:fillColor="#FED44F"/>
- <path
- android:pathData="M37.7829445,26.469236 L29.6578482,18.3441397 L18.3441397,29.6578482 L26.469236,37.7829445 C29.1911841,37.2979273 31.7972024,36.0037754 33.9004889,33.9004889 C36.0037754,31.7972024 37.2979273,29.1911841 37.7829445,26.469236 Z"
- android:fillColor="#FFC107"/>
- <path
- android:pathData="M24.0,24.0m-8.0,0.0a8.0,8.0,0,1,1,16.0,0.0a8.0,8.0,0,1,1,-16.0,0.0"
- android:fillColor="#FFFFFF"/>
-</vector>
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@drawable/icon_bg"/>
+ <foreground android:drawable="@drawable/p"/>
+</adaptive-icon>
diff --git a/packages/SystemUI/res/drawable-nodpi/icon_bg.xml b/packages/SystemUI/res/drawable-nodpi/icon_bg.xml
new file mode 100644
index 0000000..31ecf7e
--- /dev/null
+++ b/packages/SystemUI/res/drawable-nodpi/icon_bg.xml
@@ -0,0 +1,18 @@
+<!--
+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.
+-->
+<color xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="#C5E1A5" />
+
diff --git a/packages/SystemUI/res/drawable-nodpi/p.xml b/packages/SystemUI/res/drawable-nodpi/p.xml
new file mode 100644
index 0000000..596b782
--- /dev/null
+++ b/packages/SystemUI/res/drawable-nodpi/p.xml
@@ -0,0 +1,33 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="108dp"
+ android:height="108dp"
+ android:viewportWidth="108"
+ android:viewportHeight="108">
+ <path
+ android:pathData="M49,65L54,65C60.075,65 65,60.075 65,54C65,47.925 60.075,43 54,43C47.925,43 43,47.925 43,54L43,108"
+ android:strokeWidth="16"
+ android:fillColor="#00000000"
+ android:strokeColor="#7CB342"
+ android:fillType="evenOdd"/>
+ <path
+ android:pathData="M51,65L54,65C60.075,65 65,60.075 65,54C65,47.925 60.075,43 54,43C47.925,43 43,47.925 43,54L43,108"
+ android:strokeWidth="8"
+ android:fillColor="#00000000"
+ android:strokeColor="#FFFFFF"
+ android:fillType="evenOdd"/>
+</vector>
diff --git a/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml b/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
index 2e1487c..37e2b53 100644
--- a/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
+++ b/packages/SystemUI/res/layout/car_fullscreen_user_switcher.xml
@@ -39,7 +39,7 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/car_user_switcher_margin_top"
app:verticallyCenterListContent="true"
- app:dayNightStyle="force_night"
+ app:dayNightStyle="always_light"
app:showPagedListViewDivider="false"
app:gutter="both"
app:itemSpacing="@dimen/car_user_switcher_vertical_spacing_between_users"/>
diff --git a/packages/SystemUI/res/layout/car_qs_panel.xml b/packages/SystemUI/res/layout/car_qs_panel.xml
index 0e8db77..c43afc9 100644
--- a/packages/SystemUI/res/layout/car_qs_panel.xml
+++ b/packages/SystemUI/res/layout/car_qs_panel.xml
@@ -39,7 +39,7 @@
android:id="@+id/user_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:dayNightStyle="force_night"
+ app:dayNightStyle="always_light"
app:showPagedListViewDivider="false"
app:gutter="both"
app:itemSpacing="@dimen/car_user_switcher_vertical_spacing_between_users"/>
diff --git a/packages/SystemUI/res/layout/quick_qs_status_icons.xml b/packages/SystemUI/res/layout/quick_qs_status_icons.xml
index 4301fdb..94189bb 100644
--- a/packages/SystemUI/res/layout/quick_qs_status_icons.xml
+++ b/packages/SystemUI/res/layout/quick_qs_status_icons.xml
@@ -35,8 +35,7 @@
android:layout_gravity="start"
android:gravity="center_vertical"
android:singleLine="true"
- android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date"
- android:textSize="@dimen/qs_time_collapsed_size"
+ android:textAppearance="@style/TextAppearance.QS.TileLabel"
systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" />
<com.android.systemui.statusbar.phone.StatusIconContainer
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index b81d363..c59dbdc 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -22,7 +22,7 @@
<dimen name="docked_divider_handle_width">2dp</dimen>
<dimen name="docked_divider_handle_height">16dp</dimen>
- <dimen name="brightness_mirror_height">96dp</dimen>
+ <dimen name="brightness_mirror_height">40dp</dimen>
<!-- Width for the spacer, used between QS tiles. -->
<dimen name="qs_quick_tile_space_width">38dp</dimen>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 9a3bdf2..f00957a 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -204,7 +204,7 @@
<dimen name="status_bar_padding_end">6dp</dimen>
<!-- the radius of the overflow dot in the status bar -->
- <dimen name="overflow_dot_radius">1dp</dimen>
+ <dimen name="overflow_dot_radius">2dp</dimen>
<!-- the padding between dots in the icon overflow -->
<dimen name="overflow_icon_dot_padding">3dp</dimen>
@@ -287,7 +287,7 @@
<dimen name="notification_panel_width">@dimen/match_parent</dimen>
- <dimen name="brightness_mirror_height">108dp</dimen>
+ <dimen name="brightness_mirror_height">48dp</dimen>
<!-- The width of the panel that holds the quick settings. -->
<dimen name="qs_panel_width">@dimen/notification_panel_width</dimen>
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierText.java b/packages/SystemUI/src/com/android/keyguard/CarrierText.java
index 5b0f1c3..66475e2 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierText.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierText.java
@@ -334,8 +334,10 @@
break;
case SimPermDisabled:
- carrierText = getContext().getText(
- R.string.keyguard_permanent_disabled_sim_message_short);
+ carrierText = makeCarrierStringOnEmergencyCapable(
+ getContext().getText(
+ R.string.keyguard_permanent_disabled_sim_message_short),
+ text);
break;
case SimMissingLocked:
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardConstants.java b/packages/SystemUI/src/com/android/keyguard/KeyguardConstants.java
index 3927122..62b8e7c 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardConstants.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardConstants.java
@@ -26,6 +26,6 @@
* be used temporarily for debugging.
*/
public static final boolean DEBUG = false;
- public static final boolean DEBUG_SIM_STATES = false;
+ public static final boolean DEBUG_SIM_STATES = true;
public static final boolean DEBUG_FP_WAKELOCK = true;
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index b7a562b..6517a9d 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -329,7 +329,7 @@
}
public boolean hasHeader() {
- return mTitle.getVisibility() == VISIBLE;
+ return mHasHeader;
}
/**
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index c521d59..4e060f6 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -231,9 +231,9 @@
if (view == mClockView) {
float clockScale = smallClock ? mSmallClockScale : 1;
Paint.Style style = smallClock ? Paint.Style.FILL_AND_STROKE : Paint.Style.FILL;
+ mClockView.animate().cancel();
if (shouldAnimate) {
mClockView.setY(oldTop + heightOffset);
- mClockView.animate().cancel();
mClockView.animate()
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setDuration(duration)
@@ -257,10 +257,10 @@
} else if (view == mClockSeparator) {
boolean hasSeparator = hasHeader && !mPulsing;
float alpha = hasSeparator ? 1 : 0;
+ mClockSeparator.animate().cancel();
if (shouldAnimate) {
boolean isAwake = mDarkAmount != 0;
mClockSeparator.setY(oldTop + heightOffset);
- mClockSeparator.animate().cancel();
mClockSeparator.animate()
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
.setDuration(duration)
@@ -282,6 +282,7 @@
mClockView.setPivotX(mClockView.getWidth() / 2);
mClockView.setPivotY(0);
mLastLayoutHeight = getHeight();
+ layoutOwnerInfo();
}
@Override
@@ -418,9 +419,11 @@
if (mLogoutView != null) {
mLogoutView.setAlpha(dark ? 0 : 1);
}
+
if (mOwnerInfo != null) {
boolean hasText = !TextUtils.isEmpty(mOwnerInfo.getText());
- mOwnerInfo.setVisibility(hasText && mDarkAmount != 1 ? VISIBLE : GONE);
+ mOwnerInfo.setVisibility(hasText ? VISIBLE : GONE);
+ layoutOwnerInfo();
}
final int blendedTextColor = ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount);
@@ -430,6 +433,20 @@
mClockSeparator.setBackgroundColor(blendedTextColor);
}
+ private void layoutOwnerInfo() {
+ if (mOwnerInfo != null && mOwnerInfo.getVisibility() != GONE) {
+ // Animate owner info during wake-up transition
+ mOwnerInfo.setAlpha(1f - mDarkAmount);
+
+ float ratio = mDarkAmount;
+ // Calculate how much of it we should crop in order to have a smooth transition
+ int collapsed = mOwnerInfo.getTop() - mOwnerInfo.getPaddingTop();
+ int expanded = mOwnerInfo.getBottom() + mOwnerInfo.getPaddingBottom();
+ int toRemove = (int) ((expanded - collapsed) * ratio);
+ setBottom(getMeasuredHeight() - toRemove);
+ }
+ }
+
public void setPulsing(boolean pulsing, boolean animate) {
mPulsing = pulsing;
mKeyguardSlice.setPulsing(pulsing, animate);
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 6809e76..5e94dd7 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -495,6 +495,7 @@
break;
case READY:
synchronized (KeyguardViewMediator.this) {
+ if (DEBUG_SIM_STATES) Log.d(TAG, "READY, reset state? " + mShowing);
if (mShowing) {
resetStateLocked();
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
index a4927b7..615b29f 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -342,7 +342,7 @@
mHandler.post(() -> {
event.getAnimationTrigger().decrement();
});
- }, true /* notifyMenuVisibility */);
+ }, true /* notifyMenuVisibility */, false /* isDismissing */);
}
}
@@ -396,10 +396,12 @@
}
private void hideMenu() {
- hideMenu(null /* animationFinishedRunnable */, true /* notifyMenuVisibility */);
+ hideMenu(null /* animationFinishedRunnable */, true /* notifyMenuVisibility */,
+ false /* isDismissing */);
}
- private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility) {
+ private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility,
+ boolean isDismissing) {
if (mMenuState != MENU_STATE_NONE) {
cancelDelayedFinish();
if (notifyMenuVisibility) {
@@ -422,7 +424,12 @@
if (animationFinishedRunnable != null) {
animationFinishedRunnable.run();
}
- finish();
+
+ if (!isDismissing) {
+ // If we are dismissing the PiP, then don't try to pre-emptively finish the
+ // menu activity
+ finish();
+ }
}
});
mMenuContainerAnimator.start();
@@ -583,7 +590,7 @@
hideMenu(() -> {
sendEmptyMessage(PipMenuActivityController.MESSAGE_EXPAND_PIP,
"Could not notify controller to expand PIP");
- }, false /* notifyMenuVisibility */);
+ }, false /* notifyMenuVisibility */, false /* isDismissing */);
}
private void minimizePip() {
@@ -597,7 +604,7 @@
hideMenu(() -> {
sendEmptyMessage(PipMenuActivityController.MESSAGE_DISMISS_PIP,
"Could not notify controller to dismiss PIP");
- }, false /* notifyMenuVisibility */);
+ }, false /* notifyMenuVisibility */, true /* isDismissing */);
}
private void showPipMenu() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
index a48bcbd..6418c80 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSSecurityFooter.java
@@ -153,9 +153,14 @@
hasCACerts, hasCACertsInWorkProfile, isNetworkLoggingEnabled, vpnName,
vpnNameWorkProfile, organizationName, workProfileName);
// Update the icon
- int footerIconId = vpnName != null || vpnNameWorkProfile != null
- ? R.drawable.ic_qs_vpn
- : R.drawable.ic_info_outline;
+ int footerIconId = R.drawable.ic_info_outline;
+ if (vpnName != null || vpnNameWorkProfile != null) {
+ if (mSecurityController.isVpnBranded()) {
+ footerIconId = R.drawable.ic_qs_branded_vpn;
+ } else {
+ footerIconId = R.drawable.ic_qs_vpn;
+ }
+ }
if (mFooterIconId != footerIconId) {
mFooterIconId = footerIconId;
mMainHandler.post(mUpdateIcon);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java
index 23e3f25..7f3537c 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/BatterySaverTile.java
@@ -70,6 +70,9 @@
@Override
protected void handleClick() {
+ if (getState().state == Tile.STATE_UNAVAILABLE) {
+ return;
+ }
mBatteryController.setPowerSaveMode(!mPowerSave);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
index 7cb54be..e0a9148 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NightDisplayTile.java
@@ -26,6 +26,7 @@
import android.service.quicksettings.Tile;
import androidx.annotation.StringRes;
import android.text.TextUtils;
+import android.text.format.DateFormat;
import android.util.Log;
import android.widget.Switch;
@@ -48,6 +49,7 @@
*/
private static final String PATTERN_HOUR = "h a";
private static final String PATTERN_HOUR_MINUTE = "h:mm a";
+ private static final String PATTERN_HOUR_NINUTE_24 = "HH:mm";
private ColorDisplayController mController;
@@ -145,6 +147,7 @@
// Choose between just showing the hour or also showing the minutes (based on the
// user-selected toggle time). This helps reduce how much space the label takes.
toggleTimeFormat = DateTimeFormatter.ofPattern(
+ DateFormat.is24HourFormat(mContext) ? PATTERN_HOUR_NINUTE_24 :
toggleTime.getMinute() == 0 ? PATTERN_HOUR : PATTERN_HOUR_MINUTE);
return mContext.getString(toggleTimeStringRes, toggleTime.format(toggleTimeFormat));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index d647e21..60dea3a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -63,7 +63,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.CachingIconView;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
@@ -496,7 +496,7 @@
StatusBarIconView expandedIcon = mEntry.expandedIcon;
boolean isPreL = Boolean.TRUE.equals(expandedIcon.getTag(R.id.icon_is_pre_L));
boolean colorize = !isPreL || NotificationUtils.isGrayscale(expandedIcon,
- NotificationColorUtil.getInstance(mContext));
+ ContrastColorUtil.getInstance(mContext));
int color = StatusBarIconView.NO_COLOR;
if (colorize) {
NotificationHeaderView header = getVisibleNotificationHeader();
@@ -1120,10 +1120,10 @@
}
private void updateNotificationColor() {
- mNotificationColor = NotificationColorUtil.resolveContrastColor(mContext,
+ mNotificationColor = ContrastColorUtil.resolveContrastColor(mContext,
getStatusBarNotification().getNotification().color,
getBackgroundColorWithoutTint());
- mNotificationColorAmbient = NotificationColorUtil.resolveAmbientColor(mContext,
+ mNotificationColorAmbient = ContrastColorUtil.resolveAmbientColor(mContext,
getStatusBarNotification().getNotification().color);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 70dad19..a90ddf0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -36,7 +36,7 @@
import android.widget.LinearLayout;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.HybridGroupManager;
@@ -1323,7 +1323,7 @@
if (color == Notification.COLOR_DEFAULT) {
color = mContext.getColor(R.color.default_remote_input_background);
}
- existing.setBackgroundColor(NotificationColorUtil.ensureTextBackgroundColor(color,
+ existing.setBackgroundColor(ContrastColorUtil.ensureTextBackgroundColor(color,
mContext.getColor(R.color.remote_input_text_enabled),
mContext.getColor(R.color.remote_input_hint)));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index e24d65a..1a645d1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -54,7 +54,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.util.ArrayUtils;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Dependency;
import com.android.systemui.ForegroundServiceController;
import com.android.systemui.statusbar.notification.InflationException;
@@ -254,7 +254,7 @@
if (mCachedContrastColorIsFor == rawColor && mCachedContrastColor != COLOR_INVALID) {
return mCachedContrastColor;
}
- final int contrasted = NotificationColorUtil.resolveContrastColor(context, rawColor,
+ final int contrasted = ContrastColorUtil.resolveContrastColor(context, rawColor,
backgroundColor);
mCachedContrastColorIsFor = rawColor;
mCachedContrastColor = contrasted;
@@ -345,6 +345,7 @@
private final ArrayMap<String, Entry> mEntries = new ArrayMap<>();
private final ArrayList<Entry> mSortedAndFiltered = new ArrayList<>();
+ private final ArrayList<Entry> mFilteredForUser = new ArrayList<>();
private NotificationGroupManager mGroupManager;
@@ -429,6 +430,23 @@
return mSortedAndFiltered;
}
+ public ArrayList<Entry> getNotificationsForCurrentUser() {
+ mFilteredForUser.clear();
+
+ synchronized (mEntries) {
+ final int N = mEntries.size();
+ for (int i = 0; i < N; i++) {
+ Entry entry = mEntries.valueAt(i);
+ final StatusBarNotification sbn = entry.notification;
+ if (!mEnvironment.isNotificationForCurrentProfiles(sbn)) {
+ continue;
+ }
+ mFilteredForUser.add(entry);
+ }
+ }
+ return mFilteredForUser;
+ }
+
public Entry get(String key) {
return mEntries.get(key);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
index 30fa0c2..06f26c9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
@@ -681,10 +681,10 @@
}
public void updateNotificationsOnDensityOrFontScaleChanged() {
- ArrayList<NotificationData.Entry> activeNotifications =
- mNotificationData.getActiveNotifications();
- for (int i = 0; i < activeNotifications.size(); i++) {
- NotificationData.Entry entry = activeNotifications.get(i);
+ ArrayList<NotificationData.Entry> userNotifications =
+ mNotificationData.getNotificationsForCurrentUser();
+ for (int i = 0; i < userNotifications.size(); i++) {
+ NotificationData.Entry entry = userNotifications.get(i);
boolean exposedGuts = mGutsManager.getExposedGuts() != null
&& entry.row.getGuts() == mGutsManager.getExposedGuts();
entry.row.onDensityOrFontScaleChanged();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
index fac7768..3063199 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java
@@ -482,8 +482,8 @@
iconTransformDistance = Math.min(iconTransformDistance, fullHeight);
if (isLastChild) {
fullHeight = Math.min(fullHeight, row.getMinHeight() - getIntrinsicHeight());
- iconTransformDistance = Math.min(iconTransformDistance,
- row.getMinHeight() - getIntrinsicHeight() * icon.getIconScale());
+ iconTransformDistance = Math.min(iconTransformDistance, row.getMinHeight()
+ - getIntrinsicHeight());
}
float viewEnd = viewStart + fullHeight;
if (expandingAnimated && mAmbientState.getScrollY() == 0
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
index c91e213..c820e2b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java
@@ -50,7 +50,7 @@
import android.view.animation.Interpolator;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.notification.NotificationIconDozeHelper;
@@ -122,7 +122,7 @@
private final boolean mBlocked;
private int mDensity;
private float mIconScale = 1.0f;
- private final Paint mDotPaint = new Paint();
+ private final Paint mDotPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float mDotRadius;
private int mStaticDotRadius;
private int mVisibleState = STATE_ICON;
@@ -197,6 +197,7 @@
mDarkAmount);
final int outerBounds = mStatusBarIconSize;
mIconScale = (float)imageBounds / (float)outerBounds;
+ updatePivot();
}
private void updateIconScaleForSystemIcons() {
@@ -425,13 +426,12 @@
}
if (mDotAppearAmount != 0.0f) {
float radius;
- float alpha;
+ float alpha = Color.alpha(mDecorColor) / 255.f;
if (mDotAppearAmount <= 1.0f) {
radius = mDotRadius * mDotAppearAmount;
- alpha = 1.0f;
} else {
float fadeOutAmount = mDotAppearAmount - 1.0f;
- alpha = 1.0f - fadeOutAmount;
+ alpha = alpha * (1.0f - fadeOutAmount);
radius = NotificationUtils.interpolate(mDotRadius, getWidth() / 4, fadeOutAmount);
}
mDotPaint.setAlpha((int) (alpha * 255));
@@ -652,7 +652,7 @@
}
// We'll modify the color if it doesn't pass GAR
int contrastedColor = mDrawableColor;
- if (!NotificationColorUtil.satisfiesTextContrast(mCachedContrastBackgroundColor,
+ if (!ContrastColorUtil.satisfiesTextContrast(mCachedContrastBackgroundColor,
contrastedColor)) {
float[] hsl = new float[3];
ColorUtils.colorToHSL(mDrawableColor, hsl);
@@ -661,7 +661,7 @@
if (hsl[1] < 0.2f) {
contrastedColor = Notification.COLOR_DEFAULT;
}
- contrastedColor = NotificationColorUtil.resolveContrastColor(mContext,
+ contrastedColor = ContrastColorUtil.resolveContrastColor(mContext,
contrastedColor, mCachedContrastBackgroundColor);
}
mContrastedDrawableColor = contrastedColor;
@@ -860,6 +860,12 @@
mLayoutRunnable.run();
mLayoutRunnable = null;
}
+ updatePivot();
+ }
+
+ private void updatePivot() {
+ setPivotX((1 - mIconScale) / 2.0f * getWidth());
+ setPivotY((getHeight() - mIconScale * getWidth()) / 2.0f);
}
public void executeOnLayout(Runnable runnable) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
index a6bf821..d720aef 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
@@ -19,6 +19,8 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
+import android.content.pm.UserInfo;
+import android.util.Log;
import android.view.View;
import android.view.ViewStub;
@@ -60,6 +62,11 @@
}
public void show() {
+ // On a switch from the system user, don't show the user switcher
+ if (mUserManagerHelper.isHeadlessSystemUser() && mUserManagerHelper
+ .userIsSystemUser(mUserManagerHelper.getForegroundUserInfo())) {
+ return;
+ }
if (mShowing) {
return;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
index 535ec07..8c0d700 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/MediaNotificationProcessor.java
@@ -27,7 +27,7 @@
import androidx.palette.graphics.Palette;
import android.util.LayoutDirection;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.R;
import java.util.List;
@@ -155,7 +155,7 @@
}
private int selectForegroundColor(int backgroundColor, Palette palette) {
- if (NotificationColorUtil.isColorLight(backgroundColor)) {
+ if (ContrastColorUtil.isColorLight(backgroundColor)) {
return selectForegroundColorForSwatches(palette.getDarkVibrantSwatch(),
palette.getVibrantSwatch(),
palette.getDarkMutedSwatch(),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
index 91a4dda..d4b0be8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java
@@ -31,7 +31,7 @@
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.NotificationActionListLayout;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -210,7 +210,7 @@
private int blendColorWithBackground(int color, float alpha) {
// alpha doesn't go well for color filters, so let's blend it manually
- return NotificationColorUtil.compositeColors(Color.argb((int) (alpha * 255),
+ return ContrastColorUtil.compositeColors(Color.argb((int) (alpha * 255),
Color.red(color), Color.green(color), Color.blue(color)), resolveBackgroundColor());
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
index 7e2336c..66ba9e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationUtils.java
@@ -18,14 +18,11 @@
import android.content.Context;
import android.graphics.Color;
-import android.os.UserHandle;
-import android.provider.Settings;
import android.view.View;
import android.widget.ImageView;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.R;
-import com.android.systemui.statusbar.stack.NotificationChildrenContainer;
/**
* A util class for various reusable functions
@@ -33,7 +30,7 @@
public class NotificationUtils {
private static final int[] sLocationBase = new int[2];
private static final int[] sLocationOffset = new int[2];
- public static boolean isGrayscale(ImageView v, NotificationColorUtil colorUtil) {
+ public static boolean isGrayscale(ImageView v, ContrastColorUtil colorUtil) {
Object isGrayscale = v.getTag(R.id.icon_is_grayscale);
if (isGrayscale != null) {
return Boolean.TRUE.equals(isGrayscale);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
index 76860e6..f0b1a82 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/FingerprintUnlockController.java
@@ -403,10 +403,19 @@
pw.print(" mWakeLock="); pw.println(mWakeLock);
}
+ /**
+ * Successful authentication with fingerprint that wakes up the device.
+ */
public boolean isWakeAndUnlock() {
- return mMode == MODE_UNLOCK
- || mMode == MODE_WAKE_AND_UNLOCK
+ return mMode == MODE_WAKE_AND_UNLOCK
|| mMode == MODE_WAKE_AND_UNLOCK_PULSING
|| mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM;
}
+
+ /**
+ * Successful authentication with fingerprint when the screen was either on or off.
+ */
+ public boolean isFingerprintUnlock() {
+ return isWakeAndUnlock() || mMode == MODE_UNLOCK;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index a3cba2d..8b9e12c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -607,6 +607,7 @@
updateNavButtonIcons();
updateSlippery();
+ setUpSwipeUpOnboarding(isQuickStepSwipeUpEnabled());
}
public void updateNavButtonIcons() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index a78dd25..d859b5c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -11,7 +11,7 @@
import android.widget.FrameLayout;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.statusbar.ExpandableNotificationRow;
@@ -32,7 +32,7 @@
* normally reserved for notifications.
*/
public class NotificationIconAreaController implements DarkReceiver {
- private final NotificationColorUtil mNotificationColorUtil;
+ private final ContrastColorUtil mContrastColorUtil;
private final NotificationEntryManager mEntryManager;
private final Runnable mUpdateStatusBarIcons = this::updateStatusBarIcons;
@@ -50,7 +50,7 @@
public NotificationIconAreaController(Context context, StatusBar statusBar) {
mStatusBar = statusBar;
- mNotificationColorUtil = NotificationColorUtil.getInstance(context);
+ mContrastColorUtil = ContrastColorUtil.getInstance(context);
mContext = context;
mEntryManager = Dependency.get(NotificationEntryManager.class);
@@ -312,7 +312,7 @@
private void updateTintForIcon(StatusBarIconView v) {
boolean isPreL = Boolean.TRUE.equals(v.getTag(R.id.icon_is_pre_L));
int color = StatusBarIconView.NO_COLOR;
- boolean colorize = !isPreL || NotificationUtils.isGrayscale(v, mNotificationColorUtil);
+ boolean colorize = !isPreL || NotificationUtils.isGrayscale(v, mContrastColorUtil);
if (colorize) {
color = DarkIconDispatcher.getTint(mTintArea, v, mIconTint);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 08a2055..de499d6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -896,6 +896,7 @@
public void setKeyguardOccluded(boolean keyguardOccluded) {
mKeyguardOccluded = keyguardOccluded;
+ updateScrims();
}
public interface Callback {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index c70f034..7bbeed6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1599,7 +1599,9 @@
return; // called too early
}
- if (mLaunchTransitionFadingAway) {
+ boolean wakeAndUnlock = mFingerprintUnlockController != null
+ && mFingerprintUnlockController.isWakeAndUnlock();
+ if (mLaunchTransitionFadingAway || wakeAndUnlock) {
mBackdrop.setVisibility(View.INVISIBLE);
Trace.endSection();
return;
@@ -4712,11 +4714,11 @@
// We don't want to end up in KEYGUARD state when we're unlocking with
// fingerprint from doze. We should cross fade directly from black.
- final boolean wakeAndUnlocking = mFingerprintUnlockController.getMode()
- == FingerprintUnlockController.MODE_WAKE_AND_UNLOCK;
+ boolean wakeAndUnlocking = mFingerprintUnlockController.isWakeAndUnlock();
// Do not animate the scrim expansion when triggered by the fingerprint sensor.
- mScrimController.setExpansionAffectsAlpha(!mFingerprintUnlockController.isWakeAndUnlock());
+ mScrimController.setExpansionAffectsAlpha(
+ !mFingerprintUnlockController.isFingerprintUnlock());
if (mBouncerShowing) {
// Bouncer needs the front scrim when it's on top of an activity,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index 924aa01..cda9d04 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -27,7 +27,7 @@
import android.widget.Button;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.keyguard.KeyguardHostView.OnDismissAction;
import com.android.systemui.Dependency;
import com.android.systemui.R;
@@ -114,7 +114,7 @@
mRippleColor = mContext.getColor(R.color.notification_ripple_untinted_color);
mRippleColorDarkBg = Color.argb(Color.alpha(mRippleColor),
255 /* red */, 255 /* green */, 255 /* blue */);
- mMinStrokeContrast = NotificationColorUtil.calculateContrast(mDefaultStrokeColor,
+ mMinStrokeContrast = ContrastColorUtil.calculateContrast(mDefaultStrokeColor,
mDefaultBackgroundColor);
int spacing = 0;
@@ -574,12 +574,12 @@
}
mCurrentBackgroundColor = backgroundColor;
- final boolean dark = !NotificationColorUtil.isColorLight(backgroundColor);
+ final boolean dark = !ContrastColorUtil.isColorLight(backgroundColor);
- int textColor = NotificationColorUtil.ensureTextContrast(
+ int textColor = ContrastColorUtil.ensureTextContrast(
dark ? mDefaultTextColorDarkBg : mDefaultTextColor,
backgroundColor | 0xff000000, dark);
- int strokeColor = NotificationColorUtil.ensureContrast(
+ int strokeColor = ContrastColorUtil.ensureContrast(
mDefaultStrokeColor, backgroundColor | 0xff000000, dark, mMinStrokeContrast);
int rippleColor = dark ? mRippleColorDarkBg : mRippleColor;
diff --git a/packages/SystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
index bf962b8..d7fad67 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
@@ -38,6 +38,7 @@
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.media.AudioAttributes;
+import android.media.AudioManager;
import android.os.Debug;
import android.os.Handler;
import android.os.IBinder;
@@ -527,7 +528,7 @@
private final ICarVolumeCallback mVolumeChangeCallback = new ICarVolumeCallback.Stub() {
@Override
- public void onGroupVolumeChanged(int groupId) {
+ public void onGroupVolumeChanged(int groupId, int flags) {
VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
int value = getSeekbarValue(mCarAudioManager, groupId);
// Do not update the progress if it is the same as before. When car audio manager sets its
@@ -536,12 +537,14 @@
if (value != volumeItem.progress) {
volumeItem.listItem.setProgress(value);
volumeItem.progress = value;
- show(Events.SHOW_REASON_VOLUME_CHANGED);
+ if ((flags & AudioManager.FLAG_SHOW_UI) != 0) {
+ show(Events.SHOW_REASON_VOLUME_CHANGED);
+ }
}
}
@Override
- public void onMasterMuteChanged() {
+ public void onMasterMuteChanged(int flags) {
// ignored
}
};
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationDataTest.java
index 609e032..77522e4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationDataTest.java
@@ -46,7 +46,6 @@
import android.service.notification.StatusBarNotification;
import android.support.test.annotation.UiThreadTest;
import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.util.ArraySet;
@@ -62,6 +61,8 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import java.util.ArrayList;
+
@SmallTest
@RunWith(AndroidTestingRunner.class)
@RunWithLooper(setAsMainLooper = true)
@@ -280,6 +281,24 @@
}
@Test
+ public void testGetNotificationsForCurrentUser_shouldFilterNonCurrentUserNotifications()
+ throws Exception {
+ mNotificationData.add(mRow.getEntry());
+ ExpandableNotificationRow row2 = new NotificationTestHelper(getContext()).createRow();
+ mNotificationData.add(row2.getEntry());
+
+ when(mEnvironment.isNotificationForCurrentProfiles(
+ mRow.getEntry().notification)).thenReturn(false);
+ when(mEnvironment.isNotificationForCurrentProfiles(
+ row2.getEntry().notification)).thenReturn(true);
+ ArrayList<NotificationData.Entry> reuslt =
+ mNotificationData.getNotificationsForCurrentUser();
+
+ assertEquals(reuslt.size(), 1);
+ assertEquals(reuslt.get(0), row2.getEntry());
+ }
+
+ @Test
public void testIsExemptFromDndVisualSuppression_foreground() {
initStatusBarNotification(false);
when(mMockStatusBarNotification.getKey()).thenReturn(
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
index 7b2071c..8fee107 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/StatusBarIconViewTest.java
@@ -42,7 +42,7 @@
import android.support.test.runner.AndroidJUnit4;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.util.NotificationColorUtil;
+import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
@@ -115,7 +115,7 @@
mIconView.setStaticDrawableColor(Color.WHITE);
color = mIconView.getContrastedStaticDrawableColor(Color.WHITE);
assertTrue("Similar colors should be shifted to satisfy contrast",
- NotificationColorUtil.satisfiesTextContrast(Color.WHITE, color));
+ ContrastColorUtil.satisfiesTextContrast(Color.WHITE, color));
mIconView.setStaticDrawableColor(Color.GREEN);
color = mIconView.getContrastedStaticDrawableColor(0xcc000000);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index 40337b8..e95702c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -542,6 +542,18 @@
}
@Test
+ public void testHidesShowWhenLockedActivity_whenAlreadyInAod() {
+ mScrimController.setWallpaperSupportsAmbientMode(true);
+ mScrimController.transitionTo(ScrimState.AOD);
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
+
+ mScrimController.setKeyguardOccluded(true);
+ mScrimController.finishAnimationsImmediately();
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ }
+
+ @Test
public void testEatsTouchEvent() {
HashSet<ScrimState> eatsTouches =
new HashSet<>(Arrays.asList(ScrimState.AOD, ScrimState.PULSING));
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 7798cf7..b2c1bed 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -3743,6 +3743,8 @@
/**
* Removes a service.
+ * There are three states to a service here: off, bound, and binding.
+ * This stops tracking the service as bound.
*
* @param serviceConnection The service.
*/
@@ -3759,6 +3761,19 @@
scheduleNotifyClientsOfServicesStateChange(this);
}
+ /**
+ * Make sure a services disconnected but still 'on' state is reflected in UserState
+ * There are three states to a service here: off, bound, and binding.
+ * This drops a service from a bound state, to the binding state.
+ * The binding state describes the situation where a service is on, but not bound.
+ *
+ * @param serviceConnection The service.
+ */
+ public void serviceDisconnectedLocked(AccessibilityServiceConnection serviceConnection) {
+ removeServiceLocked(serviceConnection);
+ mBindingServices.add(serviceConnection.getComponentName());
+ }
+
public Set<ComponentName> getBindingServicesLocked() {
return mBindingServices;
}
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
index eb18f06..105df92 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityServiceConnection.java
@@ -258,7 +258,10 @@
return;
}
mWasConnectedAndDied = true;
- resetLocked();
+ UserState userState = mUserStateWeakReference.get();
+ if (userState != null) {
+ userState.serviceDisconnectedLocked(this);
+ }
if (mId == mSystemSupport.getMagnificationController().getIdOfLastServiceToMagnify()) {
mSystemSupport.getMagnificationController().resetIfNeeded(true);
}
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 21398e3..41e9d2b 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -1064,30 +1064,6 @@
}
@Override
- public int updateOrRestartSession(IBinder activityToken, IBinder appCallback,
- AutofillId autoFillId, Rect bounds, AutofillValue value, int userId,
- boolean hasCallback, int flags, ComponentName componentName, int sessionId,
- int action, boolean compatMode) {
- boolean restart = false;
- synchronized (mLock) {
- final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
- if (service != null) {
- restart = service.updateSessionLocked(sessionId, getCallingUid(), autoFillId,
- bounds, value, action, flags);
- } else if (sVerbose) {
- Slog.v(TAG, "updateOrRestartSession(): no service for " + userId);
- }
- }
- if (restart) {
- return startSession(activityToken, appCallback, autoFillId, bounds, value, userId,
- hasCallback, flags, componentName, compatMode);
- }
-
- // Nothing changed...
- return sessionId;
- }
-
- @Override
public void setAutofillFailure(int sessionId, @NonNull List<AutofillId> ids, int userId) {
synchronized (mLock) {
final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java
index 09f4135..1168f55 100644
--- a/services/autofill/java/com/android/server/autofill/Session.java
+++ b/services/autofill/java/com/android/server/autofill/Session.java
@@ -94,13 +94,11 @@
import com.android.server.autofill.ui.PendingUi;
import java.io.PrintWriter;
-import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
@@ -2538,13 +2536,14 @@
}
}
pw.print(prefix); pw.print("mCurrentViewId: "); pw.println(mCurrentViewId);
- pw.print(prefix); pw.print("mViewStates size: "); pw.println(mViewStates.size());
pw.print(prefix); pw.print("mDestroyed: "); pw.println(mDestroyed);
pw.print(prefix); pw.print("mIsSaving: "); pw.println(mIsSaving);
pw.print(prefix); pw.print("mPendingSaveUi: "); pw.println(mPendingSaveUi);
- for (Map.Entry<AutofillId, ViewState> entry : mViewStates.entrySet()) {
- pw.print(prefix); pw.print("State for id "); pw.println(entry.getKey());
- entry.getValue().dump(prefix2, pw);
+ final int numberViews = mViewStates.size();
+ pw.print(prefix); pw.print("mViewStates size: "); pw.println(mViewStates.size());
+ for (int i = 0; i < numberViews; i++) {
+ pw.print(prefix); pw.print("ViewState at #"); pw.println(i);
+ mViewStates.valueAt(i).dump(prefix2, pw);
}
pw.print(prefix); pw.print("mContexts: " );
@@ -2555,7 +2554,7 @@
pw.print(prefix2); pw.print(context);
if (sVerbose) {
- pw.println(context.getStructure() + " (look at logcat)");
+ pw.println("AssistStructure dumped at logcat)");
// TODO: add method on AssistStructure to dump on pw
context.getStructure().dump(false);
@@ -2856,14 +2855,6 @@
requestLog.addTaggedData(tag, value);
}
- private static String requestLogToString(@NonNull LogMaker log) {
- final StringWriter sw = new StringWriter();
- final PrintWriter pw = new PrintWriter(sw);
- dumpRequestLog(pw, log);
- pw.flush();
- return sw.toString();
- }
-
private void wtf(@Nullable Exception e, String fmt, Object...args) {
final String message = String.format(fmt, args);
mWtfHistory.log(message);
diff --git a/services/backup/java/com/android/server/backup/internal/PerformInitializeTask.java b/services/backup/java/com/android/server/backup/internal/PerformInitializeTask.java
index 88e0b7fc..1ef740d 100644
--- a/services/backup/java/com/android/server/backup/internal/PerformInitializeTask.java
+++ b/services/backup/java/com/android/server/backup/internal/PerformInitializeTask.java
@@ -130,9 +130,13 @@
IBackupTransport transport = transportClient.connectOrThrow(callerLogString);
int status = transport.initializeDevice();
-
- if (status == BackupTransport.TRANSPORT_OK) {
+ if (status != BackupTransport.TRANSPORT_OK) {
+ Slog.e(TAG, "Transport error in initializeDevice()");
+ } else {
status = transport.finishBackup();
+ if (status != BackupTransport.TRANSPORT_OK) {
+ Slog.e(TAG, "Transport error in finishBackup()");
+ }
}
// Okay, the wipe really happened. Clean up our local bookkeeping.
@@ -148,7 +152,6 @@
} else {
// If this didn't work, requeue this one and try again
// after a suitable interval
- Slog.e(TAG, "Transport error in initializeDevice()");
EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(initialize)");
mBackupManagerService.recordInitPending(true, transportName, transportDirName);
notifyResult(transportName, status);
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 99912d9..6ca81c2 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -1953,6 +1953,14 @@
pw.print(" = "); pw.println(sdf.format(new Date(nextWakeupRTC)));
pw.print(" set at "); TimeUtils.formatDuration(mLastWakeupSet, nowELAPSED, pw);
pw.println();
+
+ pw.print(" Next kernel non-wakeup alarm: ");
+ TimeUtils.formatDuration(getNextAlarm(mNativeData, ELAPSED_REALTIME), pw);
+ pw.println();
+ pw.print(" Next kernel wakeup alarm: ");
+ TimeUtils.formatDuration(getNextAlarm(mNativeData, ELAPSED_REALTIME_WAKEUP), pw);
+ pw.println();
+
pw.print(" Last wakeup: "); TimeUtils.formatDuration(mLastWakeup, nowELAPSED, pw);
pw.print(" = "); pw.println(mLastWakeup);
pw.print(" Last trigger: "); TimeUtils.formatDuration(mLastTrigger, nowELAPSED, pw);
@@ -3063,6 +3071,7 @@
private native int waitForAlarm(long nativeData);
private native int setKernelTime(long nativeData, long millis);
private native int setKernelTimezone(long nativeData, int minuteswest);
+ private native long getNextAlarm(long nativeData, int type);
private long getWhileIdleMinIntervalLocked(int uid) {
final boolean dozing = mPendingIdleUntil != null;
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 063352d..2bd6ebc 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -128,7 +128,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
import com.android.internal.net.LegacyVpnInfo;
-import com.android.internal.net.NetworkStatsFactory;
import com.android.internal.net.VpnConfig;
import com.android.internal.net.VpnInfo;
import com.android.internal.net.VpnProfile;
@@ -199,14 +198,13 @@
implements PendingIntent.OnFinished {
private static final String TAG = ConnectivityService.class.getSimpleName();
- public static final String DIAG_ARG = "--diag";
+ private static final String DIAG_ARG = "--diag";
public static final String SHORT_ARG = "--short";
- public static final String TETHERING_ARG = "tethering";
+ private static final String TETHERING_ARG = "tethering";
private static final boolean DBG = true;
private static final boolean VDBG = false;
- private static final boolean LOGD_RULES = false;
private static final boolean LOGD_BLOCKED_NETWORKINFO = true;
// TODO: create better separation between radio types and network types
@@ -241,7 +239,7 @@
@VisibleForTesting
@GuardedBy("mVpns")
- protected final SparseArray<Vpn> mVpns = new SparseArray<Vpn>();
+ protected final SparseArray<Vpn> mVpns = new SparseArray<>();
// TODO: investigate if mLockdownEnabled can be removed and replaced everywhere by
// a direct call to LockdownVpnTracker.isEnabled().
@@ -251,24 +249,16 @@
private LockdownVpnTracker mLockdownTracker;
final private Context mContext;
- private int mNetworkPreference;
// 0 is full bad, 100 is full good
private int mDefaultInetConditionPublished = 0;
- private boolean mTestMode;
- private static ConnectivityService sServiceInstance;
-
private INetworkManagementService mNetd;
private INetworkStatsService mStatsService;
private INetworkPolicyManager mPolicyManager;
private NetworkPolicyManagerInternal mPolicyManagerInternal;
- private IIpConnectivityMetrics mIpConnectivityMetrics;
private String mCurrentTcpBufferSizes;
- private static final int ENABLED = 1;
- private static final int DISABLED = 0;
-
private static final SparseArray<String> sMagicDecoderRing = MessageUtils.findMessageNames(
new Class[] { AsyncChannel.class, ConnectivityService.class, NetworkAgent.class,
NetworkAgentInfo.class });
@@ -281,7 +271,7 @@
// Don't reap networks. This should be passed when some networks have not yet been
// rematched against all NetworkRequests.
DONT_REAP
- };
+ }
private enum UnneededFor {
LINGER, // Determine whether this network is unneeded and should be lingered.
@@ -289,11 +279,6 @@
}
/**
- * used internally to change our mobile data enabled flag
- */
- private static final int EVENT_CHANGE_MOBILE_DATA_ENABLED = 2;
-
- /**
* used internally to clear a wakelock when transitioning
* from one net to another. Clear happens when we get a new
* network - EVENT_EXPIRE_NET_TRANSITION_WAKELOCK happens
@@ -446,7 +431,7 @@
// track the current default http proxy - tell the world if we get a new one (real change)
private volatile ProxyInfo mDefaultProxy = null;
- private Object mProxyLock = new Object();
+ private final Object mProxyLock = new Object();
private boolean mDefaultProxyDisabled = false;
// track the global proxy.
@@ -458,15 +443,13 @@
private UserManager mUserManager;
- NetworkConfig[] mNetConfigs;
- int mNetworksDefined;
+ private NetworkConfig[] mNetConfigs;
+ private int mNetworksDefined;
// the set of network types that can only be enabled by system/sig apps
- List mProtectedNetworks;
+ private List mProtectedNetworks;
- private DataConnectionStats mDataConnectionStats;
-
- TelephonyManager mTelephonyManager;
+ private TelephonyManager mTelephonyManager;
private KeepaliveTracker mKeepaliveTracker;
private NetworkNotificationManager mNotifier;
@@ -509,8 +492,7 @@
mLog = log;
}
}
- private final ArrayDeque<ValidationLog> mValidationLogs =
- new ArrayDeque<ValidationLog>(MAX_VALIDATION_LOGS);
+ private final ArrayDeque<ValidationLog> mValidationLogs = new ArrayDeque<>(MAX_VALIDATION_LOGS);
private void addValidationLogs(ReadOnlyLocalLog log, Network network, String name) {
synchronized (mValidationLogs) {
@@ -583,7 +565,7 @@
throw new IllegalStateException(
"legacy list for type " + type + "already initialized");
}
- mTypeLists[type] = new ArrayList<NetworkAgentInfo>();
+ mTypeLists[type] = new ArrayList<>();
}
public boolean isTypeSupported(int type) {
@@ -686,7 +668,7 @@
}
private String naiToString(NetworkAgentInfo nai) {
- String name = (nai != null) ? nai.name() : "null";
+ String name = nai.name();
String state = (nai.networkInfo != null) ?
nai.networkInfo.getState() + "/" + nai.networkInfo.getDetailedState() :
"???/???";
@@ -860,9 +842,6 @@
}
}
- mTestMode = mSystemProperties.get("cm.test.mode").equals("true")
- && mSystemProperties.get("ro.build.type").equals("eng");
-
mTethering = makeTethering();
mPermissionMonitor = new PermissionMonitor(mContext, mNetd);
@@ -889,8 +868,8 @@
mSettingsObserver = new SettingsObserver(mContext, mHandler);
registerSettingsCallbacks();
- mDataConnectionStats = new DataConnectionStats(mContext);
- mDataConnectionStats.startMonitoring();
+ final DataConnectionStats dataConnectionStats = new DataConnectionStats(mContext);
+ dataConnectionStats.startMonitoring();
mPacManager = new PacManager(mContext, mHandler, EVENT_PROXY_HAS_CHANGED);
@@ -1317,7 +1296,7 @@
// default.
enforceAccessPermission();
- HashMap<Network, NetworkCapabilities> result = new HashMap<Network, NetworkCapabilities>();
+ HashMap<Network, NetworkCapabilities> result = new HashMap<>();
NetworkAgentInfo nai = getDefaultNetwork();
NetworkCapabilities nc = getNetworkCapabilitiesInternal(nai);
@@ -1604,15 +1583,16 @@
@VisibleForTesting
protected void registerNetdEventCallback() {
- mIpConnectivityMetrics =
- (IIpConnectivityMetrics) IIpConnectivityMetrics.Stub.asInterface(
- ServiceManager.getService(IpConnectivityLog.SERVICE_NAME));
- if (mIpConnectivityMetrics == null) {
+ final IIpConnectivityMetrics ipConnectivityMetrics =
+ IIpConnectivityMetrics.Stub.asInterface(
+ ServiceManager.getService(IpConnectivityLog.SERVICE_NAME));
+ if (ipConnectivityMetrics == null) {
Slog.wtf(TAG, "Missing IIpConnectivityMetrics");
+ return;
}
try {
- mIpConnectivityMetrics.addNetdEventCallback(
+ ipConnectivityMetrics.addNetdEventCallback(
INetdEventCallback.CALLBACK_CALLER_CONNECTIVITY_SERVICE,
mNetdEventCallback);
} catch (Exception e) {
@@ -1790,7 +1770,7 @@
try {
bs.noteConnectivityChanged(intent.getIntExtra(
ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_NONE),
- ni != null ? ni.getState().toString() : "?");
+ ni.getState().toString());
} catch (RemoteException e) {
}
intent.addFlags(Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS);
@@ -1878,7 +1858,7 @@
if (iface != null && (caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) ||
caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))) {
try {
- // the call fails silently if no idletimer setup for this interface
+ // the call fails silently if no idle timer setup for this interface
mNetd.removeIdleTimer(iface);
} catch (Exception e) {
loge("Exception in removeDataActivityTracking " + e);
@@ -1887,7 +1867,7 @@
}
/**
- * Reads the network specific MTU size from reources.
+ * Reads the network specific MTU size from resources.
* and set it on it's iface.
*/
private void updateMtu(LinkProperties newLp, LinkProperties oldLp) {
@@ -2833,7 +2813,7 @@
if (!accept) {
// Tell the NetworkAgent to not automatically reconnect to the network.
nai.asyncChannel.sendMessage(NetworkAgent.CMD_PREVENT_AUTOMATIC_RECONNECT);
- // Teardown the nework.
+ // Teardown the network.
teardownUnneededNetwork(nai);
}
@@ -3101,8 +3081,7 @@
public int tether(String iface, String callerPkg) {
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
if (isTetheringSupported()) {
- final int status = mTethering.tether(iface);
- return status;
+ return mTethering.tether(iface);
} else {
return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
}
@@ -3114,8 +3093,7 @@
ConnectivityManager.enforceTetherChangePermission(mContext, callerPkg);
if (isTetheringSupported()) {
- final int status = mTethering.untether(iface);
- return status;
+ return mTethering.untether(iface);
} else {
return ConnectivityManager.TETHER_ERROR_UNSUPPORTED;
}
@@ -3349,7 +3327,7 @@
private ProxyInfo getDefaultProxy() {
// this information is already available as a world read/writable jvm property
- // so this API change wouldn't have a benifit. It also breaks the passing
+ // so this API change wouldn't have a benefit. It also breaks the passing
// of proxy info to all the JVMs.
// enforceAccessPermission();
synchronized (mProxyLock) {
@@ -3479,7 +3457,7 @@
public ProxyInfo getGlobalProxy() {
// this information is already available as a world read/writable jvm property
- // so this API change wouldn't have a benifit. It also breaks the passing
+ // so this API change wouldn't have a benefit. It also breaks the passing
// of proxy info to all the JVMs.
// enforceAccessPermission();
synchronized (mProxyLock) {
@@ -3526,7 +3504,7 @@
// the default proxy (even if it hasn't changed).
// TODO: Deprecate the broadcast extras as they aren't necessarily applicable in a multi-network
// world where an app might be bound to a non-default network.
- private void updateProxy(LinkProperties newLp, LinkProperties oldLp, NetworkAgentInfo nai) {
+ private void updateProxy(LinkProperties newLp, LinkProperties oldLp) {
ProxyInfo newProxyInfo = newLp == null ? null : newLp.getHttpProxy();
ProxyInfo oldProxyInfo = oldLp == null ? null : oldLp.getHttpProxy();
@@ -3536,7 +3514,7 @@
}
private void handleDeprecatedGlobalHttpProxy() {
- String proxy = Settings.Global.getString(mContext.getContentResolver(),
+ final String proxy = Settings.Global.getString(mContext.getContentResolver(),
Settings.Global.HTTP_PROXY);
if (!TextUtils.isEmpty(proxy)) {
String data[] = proxy.split(":");
@@ -3544,7 +3522,7 @@
return;
}
- String proxyHost = data[0];
+ final String proxyHost = data[0];
int proxyPort = 8080;
if (data.length > 1) {
try {
@@ -3553,7 +3531,7 @@
return;
}
}
- ProxyInfo p = new ProxyInfo(data[0], proxyPort, "");
+ final ProxyInfo p = new ProxyInfo(proxyHost, proxyPort, "");
setGlobalProxy(p);
}
}
@@ -3581,7 +3559,7 @@
SettingsObserver(Context context, Handler handler) {
super(null);
- mUriEventMap = new HashMap<Uri, Integer>();
+ mUriEventMap = new HashMap<>();
mContext = context;
mHandler = handler;
}
@@ -3887,7 +3865,7 @@
synchronized (mVpns) {
Vpn vpn = mVpns.get(userId);
if (vpn == null) {
- // Shouldn't happen as all codepaths that point here should have checked the Vpn
+ // Shouldn't happen as all code paths that point here should have checked the Vpn
// exists already.
Slog.wtf(TAG, "User " + userId + " has no Vpn configuration");
return false;
@@ -4051,7 +4029,7 @@
url = String.format(url,
mTelephonyManager.getSimSerialNumber() /* ICCID */,
mTelephonyManager.getDeviceId() /* IMEI */,
- phoneNumber /* Phone numer */);
+ phoneNumber /* Phone number */);
}
return url;
@@ -4178,10 +4156,8 @@
}
};
- private final HashMap<Messenger, NetworkFactoryInfo> mNetworkFactoryInfos =
- new HashMap<Messenger, NetworkFactoryInfo>();
- private final HashMap<NetworkRequest, NetworkRequestInfo> mNetworkRequests =
- new HashMap<NetworkRequest, NetworkRequestInfo>();
+ private final HashMap<Messenger, NetworkFactoryInfo> mNetworkFactoryInfos = new HashMap<>();
+ private final HashMap<NetworkRequest, NetworkRequestInfo> mNetworkRequests = new HashMap<>();
private static final int MAX_NETWORK_REQUESTS_PER_UID = 100;
// Map from UID to number of NetworkRequests that UID has filed.
@@ -4295,7 +4271,7 @@
}
private ArrayList<Integer> getSignalStrengthThresholds(NetworkAgentInfo nai) {
- final SortedSet<Integer> thresholds = new TreeSet();
+ final SortedSet<Integer> thresholds = new TreeSet<>();
synchronized (nai) {
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
if (nri.request.networkCapabilities.hasSignalStrength() &&
@@ -4304,7 +4280,7 @@
}
}
}
- return new ArrayList<Integer>(thresholds);
+ return new ArrayList<>(thresholds);
}
private void updateSignalStrengthThresholds(
@@ -4584,13 +4560,11 @@
*/
// NOTE: Accessed on multiple threads, must be synchronized on itself.
@GuardedBy("mNetworkForRequestId")
- private final SparseArray<NetworkAgentInfo> mNetworkForRequestId =
- new SparseArray<NetworkAgentInfo>();
+ private final SparseArray<NetworkAgentInfo> mNetworkForRequestId = new SparseArray<>();
// NOTE: Accessed on multiple threads, must be synchronized on itself.
@GuardedBy("mNetworkForNetId")
- private final SparseArray<NetworkAgentInfo> mNetworkForNetId =
- new SparseArray<NetworkAgentInfo>();
+ private final SparseArray<NetworkAgentInfo> mNetworkForNetId = new SparseArray<>();
// NOTE: Accessed on multiple threads, synchronized with mNetworkForNetId.
// An entry is first added to mNetIdInUse, prior to mNetworkForNetId, so
// there may not be a strict 1:1 correlation between the two.
@@ -4600,11 +4574,10 @@
// NetworkAgentInfo keyed off its connecting messenger
// TODO - eval if we can reduce the number of lists/hashmaps/sparsearrays
// NOTE: Only should be accessed on ConnectivityServiceThread, except dump().
- private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos =
- new HashMap<Messenger, NetworkAgentInfo>();
+ private final HashMap<Messenger, NetworkAgentInfo> mNetworkAgentInfos = new HashMap<>();
@GuardedBy("mBlockedAppUids")
- private final HashSet<Integer> mBlockedAppUids = new HashSet();
+ private final HashSet<Integer> mBlockedAppUids = new HashSet<>();
// Note: if mDefaultRequest is changed, NetworkMonitor needs to be updated.
private final NetworkRequest mDefaultRequest;
@@ -4714,7 +4687,7 @@
if (isDefaultNetwork(networkAgent)) {
handleApplyDefaultProxy(newLp.getHttpProxy());
} else {
- updateProxy(newLp, oldLp, networkAgent);
+ updateProxy(newLp, oldLp);
}
// TODO - move this check to cover the whole function
if (!Objects.equals(newLp, oldLp)) {
@@ -4729,7 +4702,7 @@
}
private void wakeupModifyInterface(String iface, NetworkCapabilities caps, boolean add) {
- // Marks are only available on WiFi interaces. Checking for
+ // Marks are only available on WiFi interfaces. Checking for
// marks on unsupported interfaces is harmless.
if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
return;
@@ -4761,7 +4734,7 @@
private void updateInterfaces(LinkProperties newLp, LinkProperties oldLp, int netId,
NetworkCapabilities caps) {
- CompareResult<String> interfaceDiff = new CompareResult<String>(
+ CompareResult<String> interfaceDiff = new CompareResult<>(
oldLp != null ? oldLp.getAllInterfaceNames() : null,
newLp != null ? newLp.getAllInterfaceNames() : null);
for (String iface : interfaceDiff.added) {
@@ -4796,7 +4769,7 @@
// add routes before removing old in case it helps with continuous connectivity
- // do this twice, adding non-nexthop routes first, then routes they are dependent on
+ // do this twice, adding non-next-hop routes first, then routes they are dependent on
for (RouteInfo route : routeDiff.added) {
if (route.hasGateway()) continue;
if (VDBG) log("Adding Route [" + route + "] to network " + netId);
@@ -5249,8 +5222,8 @@
// Find and migrate to this Network any NetworkRequests for
// which this network is now the best.
- ArrayList<NetworkAgentInfo> affectedNetworks = new ArrayList<NetworkAgentInfo>();
- ArrayList<NetworkRequestInfo> addedRequests = new ArrayList<NetworkRequestInfo>();
+ ArrayList<NetworkAgentInfo> affectedNetworks = new ArrayList<>();
+ ArrayList<NetworkRequestInfo> addedRequests = new ArrayList<>();
NetworkCapabilities nc = newNetwork.networkCapabilities;
if (VDBG) log(" network has: " + nc);
for (NetworkRequestInfo nri : mNetworkRequests.values()) {
@@ -5300,7 +5273,7 @@
keep = true;
// Tell NetworkFactories about the new score, so they can stop
// trying to connect if they know they cannot match it.
- // TODO - this could get expensive if we have alot of requests for this
+ // TODO - this could get expensive if we have a lot of requests for this
// network. Think about if there is a way to reduce this. Push
// netid->request mapping to each factory?
sendUpdatedScoreToFactories(nri.request, score);
@@ -5421,7 +5394,7 @@
// This has to happen after the notifyNetworkCallbacks as that tickles each
// ConnectivityManager instance so that legacy requests correctly bind dns
- // requests to this network. The legacy users are listening for this bcast
+ // requests to this network. The legacy users are listening for this broadcast
// and will generally do a dns request so they can ensureRouteToHost and if
// they do that before the callbacks happen they'll use the default network.
//
@@ -5486,7 +5459,7 @@
// TODO: This may get slow. The "changed" parameter is provided for future optimization
// to avoid the slowness. It is not simply enough to process just "changed", for
// example in the case where "changed"'s score decreases and another network should begin
- // satifying a NetworkRequest that "changed" currently satisfies.
+ // satisfying a NetworkRequest that "changed" currently satisfies.
// Optimization: Only reprocess "changed" if its score improved. This is safe because it
// can only add more NetworkRequests satisfied by "changed", and this is exactly what
@@ -5639,7 +5612,7 @@
disconnectAndDestroyNetwork(networkAgent);
} else if ((oldInfo != null && oldInfo.getState() == NetworkInfo.State.SUSPENDED) ||
state == NetworkInfo.State.SUSPENDED) {
- // going into or coming out of SUSPEND: rescore and notify
+ // going into or coming out of SUSPEND: re-score and notify
if (networkAgent.getCurrentScore() != oldScore) {
rematchAllNetworksAndRequests(networkAgent, oldScore);
}
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index 60f1877..744ed25 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -1481,19 +1481,23 @@
}
}
+ private static final String TUNNEL_OP = "STOPSHIP"; // = AppOpsManager.OP_MANAGE_IPSEC_TUNNELS;
+
private void enforceTunnelPermissions(String callingPackage) {
checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels");
- switch (getAppOpsManager().noteOp(
- AppOpsManager.OP_MANAGE_IPSEC_TUNNELS,
- Binder.getCallingUid(), callingPackage)) {
- case AppOpsManager.MODE_DEFAULT:
- mContext.enforceCallingOrSelfPermission(
- android.Manifest.permission.MANAGE_IPSEC_TUNNELS, "IpSecService");
- break;
- case AppOpsManager.MODE_ALLOWED:
- return;
- default:
- throw new SecurityException("Request to ignore AppOps for non-legacy API");
+ if (false) { // STOPSHIP if this line is present
+ switch (getAppOpsManager().noteOp(
+ TUNNEL_OP,
+ Binder.getCallingUid(), callingPackage)) {
+ case AppOpsManager.MODE_DEFAULT:
+ mContext.enforceCallingOrSelfPermission(
+ android.Manifest.permission.MANAGE_IPSEC_TUNNELS, "IpSecService");
+ break;
+ case AppOpsManager.MODE_ALLOWED:
+ return;
+ default:
+ throw new SecurityException("Request to ignore AppOps for non-legacy API");
+ }
}
}
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 183be9b..2deb759 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -220,8 +220,12 @@
private static final boolean DEBUG_EVENTS = false;
private static final boolean DEBUG_OBB = false;
- // Disable this since it messes up long-running cryptfs operations.
- private static final boolean WATCHDOG_ENABLE = false;
+ /**
+ * We now talk to vold over Binder, and it has its own internal lock to
+ * serialize certain calls. All long-running operations have been migrated
+ * to be async with callbacks, so we want watchdog to fire if vold wedges.
+ */
+ private static final boolean WATCHDOG_ENABLE = true;
/**
* Our goal is for all Android devices to be usable as development devices,
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 7ccf4c1..900bf8f 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -15201,6 +15201,7 @@
mStackSupervisor.resumeFocusedStackTopActivityLocked();
mUserController.sendUserSwitchBroadcasts(-1, currentUserId);
+ BinderInternal.nSetBinderProxyCountWatermarks(6000,5500);
BinderInternal.nSetBinderProxyCountEnabled(true);
BinderInternal.setBinderProxyCountCallback(
new BinderInternal.BinderProxyLimitListener() {
@@ -20925,15 +20926,9 @@
}
private List<ResolveInfo> collectReceiverComponents(Intent intent, String resolvedType,
- int callingUid, boolean callerInstantApp, int[] users) {
+ int callingUid, int[] users) {
// TODO: come back and remove this assumption to triage all broadcasts
int pmFlags = STOCK_PM_FLAGS | MATCH_DEBUG_TRIAGED_MISSING;
- // Instant apps should be able to send broadcasts to themselves, so we would
- // match instant receivers and later the broadcast queue would enforce that
- // the broadcast cannot be sent to a receiver outside the instant UID.
- if (callerInstantApp) {
- pmFlags |= PackageManager.MATCH_INSTANT;
- }
List<ResolveInfo> receivers = null;
try {
@@ -21562,8 +21557,7 @@
// Need to resolve the intent to interested receivers...
if ((intent.getFlags()&Intent.FLAG_RECEIVER_REGISTERED_ONLY)
== 0) {
- receivers = collectReceiverComponents(intent, resolvedType, callingUid,
- callerInstantApp, users);
+ receivers = collectReceiverComponents(intent, resolvedType, callingUid, users);
}
if (intent.getComponent() == null) {
if (userId == UserHandle.USER_ALL && callingUid == SHELL_UID) {
diff --git a/services/core/java/com/android/server/am/KeyguardController.java b/services/core/java/com/android/server/am/KeyguardController.java
index ddf9552..30fa72f 100644
--- a/services/core/java/com/android/server/am/KeyguardController.java
+++ b/services/core/java/com/android/server/am/KeyguardController.java
@@ -129,6 +129,7 @@
mKeyguardShowing = keyguardShowing;
mAodShowing = aodShowing;
mSecondaryDisplayShowing = secondaryDisplayShowing;
+ mWindowManager.setAodShowing(aodShowing);
if (showingChanged) {
dismissDockedStackIfNeeded();
setKeyguardGoingAway(false);
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index b90c12a..d515ce6 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -253,8 +253,8 @@
// 1 second, or 1 Hz frequency.
private static final long LOCATION_UPDATE_MIN_TIME_INTERVAL_MILLIS = 1000;
- // 30 seconds.
- private static final long LOCATION_UPDATE_DURATION_MILLIS = 30 * 1000;
+ // Default update duration in milliseconds for REQUEST_LOCATION.
+ private static final long LOCATION_UPDATE_DURATION_MILLIS = 0;
/** simpler wrapper for ProviderRequest + Worksource */
private static class GpsRequest {
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 6fff367..68b2a58 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -781,6 +781,9 @@
}
private void dispatchVolumeKeyLongPressLocked(KeyEvent keyEvent) {
+ if (mCurrentFullUserRecord.mOnVolumeKeyLongPressListener == null) {
+ return;
+ }
try {
mCurrentFullUserRecord.mOnVolumeKeyLongPressListener.onVolumeKeyLongPress(keyEvent);
} catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index b5f3a94..2a32d66 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -14009,43 +14009,6 @@
return false;
}
- @Override
- public boolean setSystemAppInstallState(String packageName, boolean installed, int userId) {
- enforceSystemOrPhoneCaller("setSystemAppInstallState");
- PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
- // The target app should always be in system
- if (pkgSetting == null || !pkgSetting.isSystem()) {
- return false;
- }
- // Check if the install state is the same
- if (pkgSetting.getInstalled(userId) == installed) {
- return false;
- }
-
- long callingId = Binder.clearCallingIdentity();
- try {
- if (installed) {
- // install the app from uninstalled state
- installExistingPackageAsUser(
- packageName,
- userId,
- 0 /*installFlags*/,
- PackageManager.INSTALL_REASON_DEVICE_SETUP);
- return true;
- }
-
- // uninstall the app from installed state
- deletePackageVersioned(
- new VersionedPackage(packageName, PackageManager.VERSION_CODE_HIGHEST),
- new LegacyPackageDeleteObserver(null).getBinder(),
- userId,
- PackageManager.DELETE_SYSTEM_APP);
- return true;
- } finally {
- Binder.restoreCallingIdentity(callingId);
- }
- }
-
private void sendApplicationHiddenForUser(String packageName, PackageSetting pkgSetting,
int userId) {
final PackageRemovedInfo info = new PackageRemovedInfo(this);
@@ -14110,16 +14073,10 @@
@Override
public int installExistingPackageAsUser(String packageName, int userId, int installFlags,
int installReason) {
- final int callingUid = Binder.getCallingUid();
- if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES)
- != PackageManager.PERMISSION_GRANTED
- && mContext.checkCallingOrSelfPermission(
- android.Manifest.permission.INSTALL_EXISTING_PACKAGES)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Neither user " + callingUid + " nor current process has "
- + android.Manifest.permission.INSTALL_PACKAGES + ".");
- }
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES,
+ null);
PackageSetting pkgSetting;
+ final int callingUid = Binder.getCallingUid();
mPermissionManager.enforceCrossUserPermission(callingUid, userId,
true /* requireFullPermission */, true /* checkShell */,
"installExistingPackage for user " + userId);
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 c9aa1ef..1ae59cb 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -833,11 +833,11 @@
getSystemPackage(textClassifierPackageName);
if (textClassifierPackage != null
&& doesPackageSupportRuntimePermissions(textClassifierPackage)) {
- grantRuntimePermissions(textClassifierPackage, PHONE_PERMISSIONS, true, userId);
- grantRuntimePermissions(textClassifierPackage, SMS_PERMISSIONS, true, userId);
- grantRuntimePermissions(textClassifierPackage, CALENDAR_PERMISSIONS, true, userId);
- grantRuntimePermissions(textClassifierPackage, LOCATION_PERMISSIONS, true, userId);
- grantRuntimePermissions(textClassifierPackage, CONTACTS_PERMISSIONS, true, userId);
+ grantRuntimePermissions(textClassifierPackage, PHONE_PERMISSIONS, false, userId);
+ grantRuntimePermissions(textClassifierPackage, SMS_PERMISSIONS, false, userId);
+ grantRuntimePermissions(textClassifierPackage, CALENDAR_PERMISSIONS, false, userId);
+ grantRuntimePermissions(textClassifierPackage, LOCATION_PERMISSIONS, false, userId);
+ grantRuntimePermissions(textClassifierPackage, CONTACTS_PERMISSIONS, false, userId);
}
}
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 06c9f33..8b0375f 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -816,6 +816,8 @@
private final MutableBoolean mTmpBoolean = new MutableBoolean(false);
+ private boolean mAodShowing;
+
private static final int MSG_ENABLE_POINTER_LOCATION = 1;
private static final int MSG_DISABLE_POINTER_LOCATION = 2;
private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
@@ -3058,8 +3060,15 @@
boolean keyguardLocked = isKeyguardLocked();
boolean hideDockDivider = attrs.type == TYPE_DOCK_DIVIDER
&& !mWindowManagerInternal.isStackVisible(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+ // If AOD is showing, the IME should be hidden. However, sometimes the AOD is considered
+ // hidden because it's in the process of hiding, but it's still being shown on screen.
+ // In that case, we want to continue hiding the IME until the windows have completed
+ // drawing. This way, we know that the IME can be safely shown since the other windows are
+ // now shown.
+ final boolean hideIme =
+ win.isInputMethodWindow() && (mAodShowing || !mWindowManagerDrawComplete);
return (keyguardLocked && !allowWhenLocked && win.getDisplayId() == DEFAULT_DISPLAY)
- || hideDockDivider;
+ || hideDockDivider || hideIme;
}
/** {@inheritDoc} */
@@ -5752,12 +5761,6 @@
mStatusBarController.updateVisibilityLw(false /*transientAllowed*/,
mLastSystemUiFlags, mLastSystemUiFlags);
}
- final boolean isKeyguardShowing = isStatusBarKeyguard() && !mKeyguardOccluded;
- if (statusBarExpanded && !isKeyguardShowing && mNavigationBar != null) {
- if (mNavigationBarController.setBarShowingLw(true)) {
- changes |= FINISH_LAYOUT_REDO_LAYOUT;
- }
- }
} else if (mTopFullscreenOpaqueWindowState != null) {
topIsFullscreen = topAppHidesStatusBar;
// The subtle difference between the window for mTopFullscreenOpaqueWindowState
@@ -8977,4 +8980,13 @@
public void onLockTaskStateChangedLw(int lockTaskState) {
mImmersiveModeConfirmation.onLockTaskModeChangedLw(lockTaskState);
}
+
+ @Override
+ public boolean setAodShowing(boolean aodShowing) {
+ if (mAodShowing != aodShowing) {
+ mAodShowing = aodShowing;
+ return true;
+ }
+ return false;
+ }
}
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index a1e54b6..9fbe419 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -1767,4 +1767,11 @@
* {@link ActivityManager#LOCK_TASK_MODE_PINNED}.
*/
void onLockTaskStateChangedLw(int lockTaskState);
+
+ /**
+ * Updates the flag about whether AOD is showing.
+ *
+ * @return whether the value was changed.
+ */
+ boolean setAodShowing(boolean aodShowing);
}
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index e45de45..08d0ae9 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -1334,8 +1334,20 @@
// for the next re-entry into PiP (assuming the activity is not hidden or destroyed)
final TaskStack pinnedStack = mDisplayContent.getPinnedStack();
if (pinnedStack != null) {
+ final Rect stackBounds;
+ if (pinnedStack.lastAnimatingBoundsWasToFullscreen()) {
+ // We are animating the bounds, use the pre-animation bounds to save the snap
+ // fraction
+ stackBounds = pinnedStack.mPreAnimationBounds;
+ } else {
+ // We skip the animation if the fullscreen configuration is not compatible, so
+ // use the current bounds to calculate the saved snap fraction instead
+ // (see PinnedActivityStack.skipResizeAnimation())
+ stackBounds = mTmpRect;
+ pinnedStack.getBounds(stackBounds);
+ }
mDisplayContent.mPinnedStackControllerLocked.saveReentrySnapFraction(this,
- pinnedStack.mPreAnimationBounds);
+ stackBounds);
}
}
}
diff --git a/services/core/java/com/android/server/wm/PinnedStackController.java b/services/core/java/com/android/server/wm/PinnedStackController.java
index 5f1916d..278d2b8 100644
--- a/services/core/java/com/android/server/wm/PinnedStackController.java
+++ b/services/core/java/com/android/server/wm/PinnedStackController.java
@@ -589,6 +589,7 @@
pw.println(prefix + " mImeHeight=" + mImeHeight);
pw.println(prefix + " mIsShelfShowing=" + mIsShelfShowing);
pw.println(prefix + " mShelfHeight=" + mShelfHeight);
+ pw.println(prefix + " mReentrySnapFraction=" + mReentrySnapFraction);
pw.println(prefix + " mIsMinimized=" + mIsMinimized);
if (mActions.isEmpty()) {
pw.println(prefix + " mActions=[]");
@@ -601,6 +602,7 @@
}
pw.println(prefix + " ]");
}
+ pw.println(prefix + " mDisplayInfo=" + mDisplayInfo);
}
void writeToProto(ProtoOutputStream proto, long fieldId) {
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index f17bbb9..733a248 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -28,6 +28,7 @@
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
+import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.Environment;
import android.os.Handler;
@@ -266,7 +267,7 @@
final GraphicBuffer buffer = SurfaceControl.captureLayers(
task.getSurfaceControl().getHandle(), mTmpRect, scaleFraction);
-
+ final boolean isWindowTranslucent = mainWindow.getAttrs().format != PixelFormat.OPAQUE;
if (buffer == null || buffer.getWidth() <= 1 || buffer.getHeight() <= 1) {
if (DEBUG_SCREENSHOT) {
Slog.w(TAG_WM, "Failed to take screenshot for " + task);
@@ -276,7 +277,7 @@
return new TaskSnapshot(buffer, top.getConfiguration().orientation,
getInsets(mainWindow), isLowRamDevice /* reduced */, scaleFraction /* scale */,
true /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task),
- !top.fillsParent());
+ !top.fillsParent() || isWindowTranslucent);
}
private boolean shouldDisableSnapshots() {
@@ -363,11 +364,13 @@
if (hwBitmap == null) {
return null;
}
+ // Note, the app theme snapshot is never translucent because we enforce a non-translucent
+ // color above
return new TaskSnapshot(hwBitmap.createGraphicBufferHandle(),
topChild.getConfiguration().orientation, mainWindow.mStableInsets,
ActivityManager.isLowRamDeviceStatic() /* reduced */, 1.0f /* scale */,
false /* isRealSnapshot */, task.getWindowingMode(), getSystemUiVisibility(task),
- !topChild.fillsParent());
+ false);
}
/**
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index c59540b..76c9c26 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -1682,6 +1682,10 @@
if (finalStackSize != null) {
setPinnedStackSize(finalStackSize, null);
+ } else {
+ // We have been canceled, so the final stack size is null, still run the
+ // animation-end logic
+ onPipAnimationEndResize();
}
try {
@@ -1693,6 +1697,9 @@
} catch (RemoteException e) {
// I don't believe you...
}
+ } else {
+ // No PiP animation, just run the normal animation-end logic
+ onPipAnimationEndResize();
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 9c94311..947c937 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7577,4 +7577,17 @@
mPolicy.onLockTaskStateChangedLw(lockTaskState);
}
}
+
+ /**
+ * Updates {@link WindowManagerPolicy} with new value about whether AOD is showing. If AOD
+ * has changed, this will trigger a {@link WindowSurfacePlacer#performSurfacePlacement} to
+ * ensure the new value takes effect.
+ */
+ public void setAodShowing(boolean aodShowing) {
+ synchronized (mWindowMap) {
+ if (mPolicy.setAodShowing(aodShowing)) {
+ mWindowPlacerLocked.performSurfacePlacement();
+ }
+ }
+ }
}
diff --git a/services/core/jni/com_android_server_AlarmManagerService.cpp b/services/core/jni/com_android_server_AlarmManagerService.cpp
index 47350c1..921eed9 100644
--- a/services/core/jni/com_android_server_AlarmManagerService.cpp
+++ b/services/core/jni/com_android_server_AlarmManagerService.cpp
@@ -81,6 +81,7 @@
int set(int type, struct timespec *ts);
int setTime(struct timeval *tv);
int waitForAlarm();
+ int getTime(int type, struct itimerspec *spec);
private:
const TimerFds fds;
@@ -118,6 +119,16 @@
return timerfd_settime(fds[type], TFD_TIMER_ABSTIME, &spec, NULL);
}
+int AlarmImpl::getTime(int type, struct itimerspec *spec)
+{
+ if (static_cast<size_t>(type) > ANDROID_ALARM_TYPE_COUNT) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ return timerfd_gettime(fds[type], spec);
+}
+
int AlarmImpl::setTime(struct timeval *tv)
{
struct rtc_time rtc;
@@ -379,6 +390,23 @@
return reinterpret_cast<jlong>(ret);
}
+static jlong android_server_AlarmManagerService_getNextAlarm(JNIEnv*, jobject, jlong nativeData, jint type)
+{
+ AlarmImpl *impl = reinterpret_cast<AlarmImpl *>(nativeData);
+ struct itimerspec spec;
+ memset(&spec, 0, sizeof(spec));
+ const int result = impl->getTime(type, &spec);
+ if (result < 0)
+ {
+ ALOGE("timerfd_gettime() failed for fd %d: %s\n", static_cast<int>(type), strerror(errno));
+ return result;
+ }
+ struct timespec nextTimespec = spec.it_value;
+ long long millis = nextTimespec.tv_sec * 1000LL;
+ millis += (nextTimespec.tv_nsec / 1000000LL);
+ return static_cast<jlong>(millis);
+}
+
static void android_server_AlarmManagerService_close(JNIEnv*, jobject, jlong nativeData)
{
AlarmImpl *impl = reinterpret_cast<AlarmImpl *>(nativeData);
@@ -429,6 +457,7 @@
{"waitForAlarm", "(J)I", (void*)android_server_AlarmManagerService_waitForAlarm},
{"setKernelTime", "(JJ)I", (void*)android_server_AlarmManagerService_setKernelTime},
{"setKernelTimezone", "(JI)I", (void*)android_server_AlarmManagerService_setKernelTimezone},
+ {"getNextAlarm", "(JI)J", (void*)android_server_AlarmManagerService_getNextAlarm},
};
int register_android_server_AlarmManagerService(JNIEnv* env)
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 288a544..19ee42f 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -2354,8 +2354,12 @@
final String value = Boolean.toString(hasDeviceOwner);
mInjector.systemPropertiesSet(PROPERTY_DEVICE_OWNER_PRESENT, value);
Slog.i(LOG_TAG, "Set ro.device_owner property to " + value);
+ }
+ }
- if (hasDeviceOwner && mInjector.securityLogGetLoggingEnabledProperty()) {
+ private void maybeStartSecurityLogMonitorOnActivityManagerReady() {
+ synchronized (getLockObject()) {
+ if (mInjector.securityLogIsLoggingEnabled()) {
mSecurityLogMonitor.start();
mInjector.runCryptoSelfTest();
maybePauseDeviceWideLoggingLocked();
@@ -3354,6 +3358,9 @@
loadAdminDataAsync();
mOwners.systemReady();
break;
+ case SystemService.PHASE_ACTIVITY_MANAGER_READY:
+ maybeStartSecurityLogMonitorOnActivityManagerReady();
+ break;
case SystemService.PHASE_BOOT_COMPLETED:
ensureDeviceOwnerUserStarted(); // TODO Consider better place to do this.
break;
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index f642599..dc6a613 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -199,10 +199,10 @@
"com.android.server.search.SearchManagerService$Lifecycle";
private static final String THERMAL_OBSERVER_CLASS =
"com.google.android.clockwork.ThermalObserver";
- private static final String WEAR_CONFIG_SERVICE_CLASS =
- "com.google.android.clockwork.WearConfigManagerService";
private static final String WEAR_CONNECTIVITY_SERVICE_CLASS =
"com.android.clockwork.connectivity.WearConnectivityService";
+ private static final String WEAR_POWER_SERVICE_CLASS =
+ "com.android.clockwork.power.WearPowerService";
private static final String WEAR_SIDEKICK_SERVICE_CLASS =
"com.google.android.clockwork.sidekick.SidekickService";
private static final String WEAR_DISPLAY_SERVICE_CLASS =
@@ -1551,16 +1551,20 @@
}
if (isWatch) {
- traceBeginAndSlog("StartWearConfigService");
- mSystemServiceManager.startService(WEAR_CONFIG_SERVICE_CLASS);
+ // Must be started before services that depend it, e.g. WearConnectivityService
+ traceBeginAndSlog("StartWearPowerService");
+ mSystemServiceManager.startService(WEAR_POWER_SERVICE_CLASS);
traceEnd();
traceBeginAndSlog("StartWearConnectivityService");
mSystemServiceManager.startService(WEAR_CONNECTIVITY_SERVICE_CLASS);
traceEnd();
- traceBeginAndSlog("StartWearTimeService");
+ traceBeginAndSlog("StartWearDisplayService");
mSystemServiceManager.startService(WEAR_DISPLAY_SERVICE_CLASS);
+ traceEnd();
+
+ traceBeginAndSlog("StartWearTimeService");
mSystemServiceManager.startService(WEAR_TIME_SERVICE_CLASS);
traceEnd();
diff --git a/services/robotests/src/com/android/server/backup/internal/PerformInitializeTaskTest.java b/services/robotests/src/com/android/server/backup/internal/PerformInitializeTaskTest.java
index 5810c30..646367e 100644
--- a/services/robotests/src/com/android/server/backup/internal/PerformInitializeTaskTest.java
+++ b/services/robotests/src/com/android/server/backup/internal/PerformInitializeTaskTest.java
@@ -19,6 +19,7 @@
import static android.app.backup.BackupTransport.TRANSPORT_ERROR;
import static android.app.backup.BackupTransport.TRANSPORT_OK;
+import static com.android.server.backup.testing.TestUtils.assertLogcatContains;
import static com.android.server.backup.testing.TransportData.backupTransport;
import static com.android.server.backup.testing.TransportData.d2dTransport;
import static com.android.server.backup.testing.TransportData.localTransport;
@@ -40,6 +41,7 @@
import android.app.backup.IBackupObserver;
import android.os.DeadObjectException;
import android.platform.test.annotations.Presubmit;
+import android.util.Log;
import com.android.internal.backup.IBackupTransport;
import com.android.server.backup.BackupManagerService;
@@ -50,6 +52,8 @@
import com.android.server.backup.transport.TransportClient;
import com.android.server.testing.FrameworkRobolectricTestRunner;
import com.android.server.testing.SystemLoaderPackages;
+import com.android.server.testing.shadows.ShadowSlog;
+
import org.junit.Before;
import org.junit.Test;
@@ -66,7 +70,7 @@
import java.util.stream.Stream;
@RunWith(FrameworkRobolectricTestRunner.class)
-@Config(manifest = Config.NONE, sdk = 26)
+@Config(manifest = Config.NONE, sdk = 26, shadows = ShadowSlog.class)
@SystemLoaderPackages({"com.android.server.backup"})
@Presubmit
public class PerformInitializeTaskTest {
@@ -202,6 +206,32 @@
}
@Test
+ public void testRun_whenFinishBackupFails_logs() throws Exception {
+ setUpTransport(mTransport);
+ configureTransport(mTransportBinder, TRANSPORT_OK, TRANSPORT_ERROR);
+ PerformInitializeTask performInitializeTask = createPerformInitializeTask(mTransportName);
+
+ performInitializeTask.run();
+
+ assertLogcatContains(
+ BackupManagerService.TAG,
+ log -> log.msg.contains("finishBackup()") && log.type >= Log.ERROR);
+ }
+
+ @Test
+ public void testRun_whenInitializeDeviceFails_logs() throws Exception {
+ setUpTransport(mTransport);
+ configureTransport(mTransportBinder, TRANSPORT_ERROR, 0);
+ PerformInitializeTask performInitializeTask = createPerformInitializeTask(mTransportName);
+
+ performInitializeTask.run();
+
+ assertLogcatContains(
+ BackupManagerService.TAG,
+ log -> log.msg.contains("initializeDevice()") && log.type >= Log.ERROR);
+ }
+
+ @Test
public void testRun_whenFinishBackupFails_schedulesAlarm() throws Exception {
setUpTransport(mTransport);
configureTransport(mTransportBinder, TRANSPORT_OK, TRANSPORT_ERROR);
diff --git a/services/robotests/src/com/android/server/backup/testing/TestUtils.java b/services/robotests/src/com/android/server/backup/testing/TestUtils.java
index 3db4162..3c84424 100644
--- a/services/robotests/src/com/android/server/backup/testing/TestUtils.java
+++ b/services/robotests/src/com/android/server/backup/testing/TestUtils.java
@@ -21,6 +21,7 @@
import org.robolectric.shadows.ShadowLog;
import java.util.concurrent.Callable;
+import java.util.function.Predicate;
public class TestUtils {
/** Reset logcat with {@link ShadowLog#reset()} before the test case */
@@ -35,6 +36,10 @@
.isTrue();
}
+ public static void assertLogcatContains(String tag, Predicate<ShadowLog.LogItem> predicate) {
+ assertThat(ShadowLog.getLogsForTag(tag).stream().anyMatch(predicate)).isTrue();
+ }
+
/**
* Calls {@link Runnable#run()} and returns if no exception is thrown. Otherwise, if the
* exception is unchecked, rethrow it; if it's checked wrap in a {@link RuntimeException} and
diff --git a/services/robotests/src/com/android/server/testing/shadows/ShadowSlog.java b/services/robotests/src/com/android/server/testing/shadows/ShadowSlog.java
index bf4b61e..737b0c8 100644
--- a/services/robotests/src/com/android/server/testing/shadows/ShadowSlog.java
+++ b/services/robotests/src/com/android/server/testing/shadows/ShadowSlog.java
@@ -26,6 +26,86 @@
@Implements(Slog.class)
public class ShadowSlog {
@Implementation
+ public static int v(String tag, String msg) {
+ return Log.v(tag, msg);
+ }
+
+ @Implementation
+ public static int v(String tag, String msg, Throwable tr) {
+ return Log.v(tag, msg, tr);
+ }
+
+ @Implementation
+ public static int d(String tag, String msg) {
+ return Log.d(tag, msg);
+ }
+
+ @Implementation
+ public static int d(String tag, String msg, Throwable tr) {
+ return Log.d(tag, msg, tr);
+ }
+
+ @Implementation
+ public static int i(String tag, String msg) {
+ return Log.i(tag, msg);
+ }
+
+ @Implementation
+ public static int i(String tag, String msg, Throwable tr) {
+ return Log.i(tag, msg, tr);
+ }
+
+ @Implementation
+ public static int w(String tag, String msg) {
+ return Log.w(tag, msg);
+ }
+
+ @Implementation
+ public static int w(String tag, String msg, Throwable tr) {
+ return Log.w(tag, msg, tr);
+ }
+
+ @Implementation
+ public static int w(String tag, Throwable tr) {
+ return Log.w(tag, tr);
+ }
+
+ @Implementation
+ public static int e(String tag, String msg) {
+ return Log.e(tag, msg);
+ }
+
+ @Implementation
+ public static int e(String tag, String msg, Throwable tr) {
+ return Log.e(tag, msg, tr);
+ }
+
+ @Implementation
+ public static int wtf(String tag, String msg) {
+ return Log.wtf(tag, msg);
+ }
+
+ @Implementation
+ public static void wtfQuiet(String tag, String msg) {
+ Log.wtf(tag, msg);
+ }
+
+ @Implementation
+ public static int wtfStack(String tag, String msg) {
+ return Log.wtf(tag, msg);
+ }
+
+ @Implementation
+ public static int wtf(String tag, Throwable tr) {
+ return Log.wtf(tag, tr);
+ }
+
+ @Implementation
+ public static int wtf(String tag, String msg, Throwable tr) {
+ return Log.wtf(tag, msg, tr);
+ }
+
+ @Implementation
public static int println(int priority, String tag, String msg) {
return Log.println(priority, tag, msg);
}
diff --git a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
index 50f3fbe..ee028ba 100644
--- a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
+++ b/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java
@@ -598,4 +598,9 @@
@Override
public void onLockTaskStateChangedLw(int lockTaskState) {
}
+
+ @Override
+ public boolean setAodShowing(boolean aodShowing) {
+ return false;
+ }
}
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 16f8fba..1d5eece 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -207,8 +207,8 @@
@Override
public void onBootPhase(int phase) {
+ mAppStandby.onBootPhase(phase);
if (phase == PHASE_SYSTEM_SERVICES_READY) {
- mAppStandby.onBootPhase(phase);
// initialize mDpmInternal
getDpmInternal();
@@ -699,6 +699,29 @@
== PackageManager.PERMISSION_GRANTED;
}
+ private void checkCallerIsSystemOrSameApp(String pkg) {
+ if (isCallingUidSystem()) {
+ return;
+ }
+ checkCallerIsSameApp(pkg);
+ }
+
+ private void checkCallerIsSameApp(String pkg) {
+ final int callingUid = Binder.getCallingUid();
+ final int callingUserId = UserHandle.getUserId(callingUid);
+
+ if (mPackageManagerInternal.getPackageUid(pkg, /*flags=*/ 0,
+ callingUserId) != callingUid) {
+ throw new SecurityException("Calling uid " + pkg + " cannot query events"
+ + "for package " + pkg);
+ }
+ }
+
+ private boolean isCallingUidSystem() {
+ final int uid = Binder.getCallingUid();
+ return uid == Process.SYSTEM_UID;
+ }
+
@Override
public ParceledListSlice<UsageStats> queryUsageStats(int bucketType, long beginTime,
long endTime, String callingPackage) {
@@ -792,11 +815,7 @@
final int callingUid = Binder.getCallingUid();
final int callingUserId = UserHandle.getUserId(callingUid);
- if (mPackageManagerInternal.getPackageUid(callingPackage, PackageManager.MATCH_ANY_USER,
- callingUserId) != callingUid) {
- throw new SecurityException("Calling uid " + callingPackage + " cannot query events"
- + "for package " + callingPackage);
- }
+ checkCallerIsSameApp(callingPackage);
final long token = Binder.clearCallingIdentity();
try {
return UsageStatsService.this.queryEventsForPackage(callingUserId, beginTime,
@@ -807,6 +826,53 @@
}
@Override
+ public UsageEvents queryEventsForUser(long beginTime, long endTime, int userId,
+ String callingPackage) {
+ if (!hasPermission(callingPackage)) {
+ return null;
+ }
+
+ if (userId != UserHandle.getCallingUserId()) {
+ getContext().enforceCallingPermission(
+ Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+ "No permission to query usage stats for this user");
+ }
+
+ final boolean obfuscateInstantApps = shouldObfuscateInstantAppsForCaller(
+ Binder.getCallingUid(), UserHandle.getCallingUserId());
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return UsageStatsService.this.queryEvents(userId, beginTime, endTime,
+ obfuscateInstantApps);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
+ public UsageEvents queryEventsForPackageForUser(long beginTime, long endTime,
+ int userId, String pkg, String callingPackage) {
+ if (!hasPermission(callingPackage)) {
+ return null;
+ }
+ if (userId != UserHandle.getCallingUserId()) {
+ getContext().enforceCallingPermission(
+ Manifest.permission.INTERACT_ACROSS_USERS_FULL,
+ "No permission to query usage stats for this user");
+ }
+ checkCallerIsSystemOrSameApp(pkg);
+
+ final long token = Binder.clearCallingIdentity();
+ try {
+ return UsageStatsService.this.queryEventsForPackage(userId, beginTime,
+ endTime, callingPackage);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public boolean isAppInactive(String packageName, int userId) {
try {
userId = ActivityManager.getService().handleIncomingUser(Binder.getCallingPid(),
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 9d78490..2291090 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -1531,6 +1531,14 @@
new DisconnectCause(DisconnectCause.ERROR, "IMPL_RETURNED_NULL_CONNECTION"));
}
+ boolean isSelfManaged =
+ (connection.getConnectionProperties() & Connection.PROPERTY_SELF_MANAGED)
+ == Connection.PROPERTY_SELF_MANAGED;
+ // Self-managed Connections should always use voip audio mode; we default here so that the
+ // local state within the ConnectionService matches the default we assume in Telecom.
+ if (isSelfManaged) {
+ connection.setAudioModeIsVoip(true);
+ }
connection.setTelecomCallId(callId);
if (connection.getState() != Connection.STATE_DISCONNECTED) {
addConnection(request.getAccountHandle(), callId, connection);
@@ -1570,9 +1578,7 @@
createIdList(connection.getConferenceables()),
connection.getExtras()));
- if (isIncoming && request.shouldShowIncomingCallUi() &&
- (connection.getConnectionProperties() & Connection.PROPERTY_SELF_MANAGED) ==
- Connection.PROPERTY_SELF_MANAGED) {
+ if (isIncoming && request.shouldShowIncomingCallUi() && isSelfManaged) {
// Tell ConnectionService to show its incoming call UX.
connection.onShowIncomingCallUi();
}
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 145ed7e..c68a780 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -40,7 +40,14 @@
import java.util.Objects;
/**
- * A class representing an APN configuration.
+ * An Access Point Name (APN) configuration for a carrier data connection.
+ *
+ * <p>The APN provides configuration to connect a cellular network device to an IP data network. A
+ * carrier uses the name, type and other configuration in an {@code APNSetting} to decide which IP
+ * address to assign, any security methods to apply, and how the device might be connected to
+ * private networks.
+ *
+ * <p>Use {@link ApnSetting.Builder} to create new instances.
*/
public class ApnSetting implements Parcelable {
@@ -336,7 +343,7 @@
}
/**
- * Returns the entry name of the APN.
+ * Gets the human-readable name that describes the APN.
*
* @return the entry name for the APN
*/
@@ -354,18 +361,21 @@
}
/**
- * Returns the proxy address of the APN.
+ * Gets the HTTP proxy address configured for the APN. The proxy address might be an IP address
+ * or hostname. This method returns {@code null} if system networking (typically DNS) isn’t
+ * available to resolve a hostname value—values set as IP addresses don’t have this restriction.
+ * This is a known problem and will be addressed in a future release.
*
- * @return proxy address.
+ * @return the HTTP proxy address or {@code null} if DNS isn’t available to resolve a hostname
*/
public InetAddress getProxyAddress() {
return mProxyAddress;
}
/**
- * Returns the proxy port of the APN.
+ * Returns the proxy address of the APN.
*
- * @return proxy port
+ * @return proxy address.
*/
public int getProxyPort() {
return mProxyPort;
@@ -380,9 +390,12 @@
}
/**
- * Returns the MMS proxy address of the APN.
+ * Gets the MMS proxy address configured for the APN. The MMS proxy address might be an IP
+ * address or hostname. This method returns {@code null} if system networking (typically DNS)
+ * isn’t available to resolve a hostname value—values set as IP addresses don’t have this
+ * restriction. This is a known problem and will be addressed in a future release.
*
- * @return MMS proxy address.
+ * @return the MMS proxy address or {@code null} if DNS isn’t available to resolve a hostname
*/
public InetAddress getMmsProxyAddress() {
return mMmsProxyAddress;
@@ -1040,6 +1053,39 @@
return value == null ? NOT_IN_MAP_INT : value;
}
+ /**
+ * Provides a convenient way to set the fields of a {@link ApnSetting} when creating a new
+ * instance. The following settings are required to build an {@code ApnSetting}:
+ *
+ * <ul><li>apnTypeBitmask</li>
+ * <li>apnName</li>
+ * <li>entryName</li></ul>
+ *
+ * <p>The example below shows how you might create a new {@code ApnSetting}:
+ *
+ * <pre><code>
+ * // Create an MMS proxy address with a hostname. A network might not be
+ * // available, so supply a dummy (0.0.0.0) IPv4 address to avoid DNS lookup.
+ * String host = "mms.example.com";
+ * byte[] ipAddress = new byte[4];
+ * InetAddress mmsProxy;
+ * try {
+ * mmsProxy = InetAddress.getByAddress(host, ipAddress);
+ * } catch (UnknownHostException e) {
+ * e.printStackTrace();
+ * return;
+ * }
+ *
+ * ApnSetting apn = new ApnSetting.Builder()
+ * .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT | ApnSetting.TYPE_MMS)
+ * .setApnName("apn.example.com")
+ * .setEntryName("Example Carrier APN")
+ * .setMmsc(Uri.parse("http://mms.example.com:8002"))
+ * .setMmsProxyAddress(mmsProxy)
+ * .setMmsProxyPort(8799)
+ * .build();
+ * </code></pre>
+ */
public static class Builder{
private String mEntryName;
private String mApnName;
@@ -1160,7 +1206,7 @@
}
/**
- * Sets the entry name of the APN.
+ * Sets a human-readable name that describes the APN.
*
* @param entryName the entry name to set for the APN
*/
@@ -1180,7 +1226,15 @@
}
/**
- * Sets the proxy address of the APN.
+ * Sets the address of an HTTP proxy for the APN. The proxy address can be an IP address or
+ * hostname. If {@code proxy} contains both an IP address and hostname, this method ignores
+ * the IP address.
+ *
+ * <p>The {@link java.net.InetAddress} methods
+ * {@link java.net.InetAddress#getAllByName getAllByName()} require DNS for hostname
+ * resolution. To avoid this requirement when setting a hostname, call
+ * {@link java.net.InetAddress#getByAddress(java.lang.String, byte[])} with both the
+ * hostname and a dummy IP address. See {@link ApnSetting.Builder above} for an example.
*
* @param proxy the proxy address to set for the APN
*/
@@ -1210,7 +1264,16 @@
}
/**
- * Sets the MMS proxy address of the APN.
+ * Sets the address of an MMS proxy for the APN. The MMS proxy address can be an IP address
+ * or hostname. If {@code mmsProxy} contains both an IP address and hostname, this method
+ * ignores the IP address.
+ *
+ * <p>The {@link java.net.InetAddress} methods
+ * {@link java.net.InetAddress#getByName getByName()} and
+ * {@link java.net.InetAddress#getAllByName getAllByName()} require DNS for hostname
+ * resolution. To avoid this requirement when setting a hostname, call
+ * {@link java.net.InetAddress#getByAddress(java.lang.String, byte[])} with both the
+ * hostname and a dummy IP address. See {@link ApnSetting.Builder above} for an example.
*
* @param mmsProxy the MMS proxy address to set for the APN
*/
@@ -1358,4 +1421,3 @@
}
}
}
-
diff --git a/telephony/java/com/android/internal/telephony/CarrierAppUtils.java b/telephony/java/com/android/internal/telephony/CarrierAppUtils.java
index 676684c..bcad554 100644
--- a/telephony/java/com/android/internal/telephony/CarrierAppUtils.java
+++ b/telephony/java/com/android/internal/telephony/CarrierAppUtils.java
@@ -152,14 +152,9 @@
&& (ai.enabledSetting ==
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|| ai.enabledSetting ==
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
- || (ai.flags & ApplicationInfo.FLAG_INSTALLED) == 0)) {
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
Slog.i(TAG, "Update state(" + packageName + "): ENABLED for user "
+ userId);
- packageManager.setSystemAppInstallState(
- packageName,
- true /*installed*/,
- userId);
packageManager.setApplicationEnabledSetting(
packageName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
@@ -175,14 +170,9 @@
if (associatedApp.enabledSetting ==
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
|| associatedApp.enabledSetting ==
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
- || (ai.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) {
Slog.i(TAG, "Update associated state(" + associatedApp.packageName
+ "): ENABLED for user " + userId);
- packageManager.setSystemAppInstallState(
- associatedApp.packageName,
- true /*installed*/,
- userId);
packageManager.setApplicationEnabledSetting(
associatedApp.packageName,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
@@ -200,14 +190,15 @@
// updated we shouldn't touch it.
if (!ai.isUpdatedSystemApp()
&& ai.enabledSetting ==
- PackageManager.COMPONENT_ENABLED_STATE_DEFAULT
- && (ai.flags & ApplicationInfo.FLAG_INSTALLED) != 0) {
+ PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
Slog.i(TAG, "Update state(" + packageName
+ "): DISABLED_UNTIL_USED for user " + userId);
- packageManager.setSystemAppInstallState(
+ packageManager.setApplicationEnabledSetting(
packageName,
- false /*installed*/,
- userId);
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
+ 0,
+ userId,
+ callingPackage);
}
// Also disable any associated apps for this carrier app if this is the first
@@ -222,10 +213,13 @@
Slog.i(TAG,
"Update associated state(" + associatedApp.packageName
+ "): DISABLED_UNTIL_USED for user " + userId);
- packageManager.setSystemAppInstallState(
+ packageManager.setApplicationEnabledSetting(
associatedApp.packageName,
- false /*installed*/,
- userId);
+ PackageManager
+ .COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED,
+ 0,
+ userId,
+ callingPackage);
}
}
}
@@ -363,8 +357,7 @@
String packageName) {
try {
ApplicationInfo ai = packageManager.getApplicationInfo(packageName,
- PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
- | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS, userId);
+ PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS, userId);
if (ai != null && ai.isSystemApp()) {
return ai;
}
diff --git a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
index e573d35..102cb7c 100644
--- a/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
+++ b/tests/net/java/com/android/server/IpSecServiceParameterizedTest.java
@@ -50,6 +50,7 @@
import java.util.Collection;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -592,6 +593,7 @@
}
}
+ @Ignore
@Test
public void testAddTunnelFailsForBadPackageName() throws Exception {
try {
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py
index 70a47cf..9db3f02 100644
--- a/tools/apilint/apilint.py
+++ b/tools/apilint/apilint.py
@@ -1334,18 +1334,25 @@
error(clazz, m, None, "Provide an explicit copy constructor instead of implementing clone()")
+def is_interesting(clazz):
+ """Test if given class is interesting from an Android PoV."""
+
+ if clazz.pkg.name.startswith("java"): return False
+ if clazz.pkg.name.startswith("junit"): return False
+ if clazz.pkg.name.startswith("org.apache"): return False
+ if clazz.pkg.name.startswith("org.xml"): return False
+ if clazz.pkg.name.startswith("org.json"): return False
+ if clazz.pkg.name.startswith("org.w3c"): return False
+ if clazz.pkg.name.startswith("android.icu."): return False
+ return True
+
+
def examine_clazz(clazz):
"""Find all style issues in the given class."""
notice(clazz)
- if clazz.pkg.name.startswith("java"): return
- if clazz.pkg.name.startswith("junit"): return
- if clazz.pkg.name.startswith("org.apache"): return
- if clazz.pkg.name.startswith("org.xml"): return
- if clazz.pkg.name.startswith("org.json"): return
- if clazz.pkg.name.startswith("org.w3c"): return
- if clazz.pkg.name.startswith("android.icu."): return
+ if not is_interesting(clazz): return
verify_constants(clazz)
verify_enums(clazz)
@@ -1479,6 +1486,7 @@
# Remove all existing things so we're left with new
for prev_clazz in prev.values():
cur_clazz = cur[prev_clazz.fullname]
+ if not is_interesting(cur_clazz): continue
sigs = { i.ident: i for i in prev_clazz.ctors }
cur_clazz.ctors = [ i for i in cur_clazz.ctors if i.ident not in sigs ]
@@ -1506,6 +1514,38 @@
print
+def show_stats(cur, prev):
+ """Show API stats."""
+
+ stats = collections.defaultdict(int)
+ for cur_clazz in cur.values():
+ if not is_interesting(cur_clazz): continue
+
+ if cur_clazz.fullname not in prev:
+ stats['new_classes'] += 1
+ stats['new_ctors'] += len(cur_clazz.ctors)
+ stats['new_methods'] += len(cur_clazz.methods)
+ stats['new_fields'] += len(cur_clazz.fields)
+ else:
+ prev_clazz = prev[cur_clazz.fullname]
+
+ sigs = { i.ident: i for i in prev_clazz.ctors }
+ ctors = len([ i for i in cur_clazz.ctors if i.ident not in sigs ])
+ sigs = { i.ident: i for i in prev_clazz.methods }
+ methods = len([ i for i in cur_clazz.methods if i.ident not in sigs ])
+ sigs = { i.ident: i for i in prev_clazz.fields }
+ fields = len([ i for i in cur_clazz.fields if i.ident not in sigs ])
+
+ if ctors + methods + fields > 0:
+ stats['extend_classes'] += 1
+ stats['extend_ctors'] += ctors
+ stats['extend_methods'] += methods
+ stats['extend_fields'] += fields
+
+ print "#", "".join([ k.ljust(20) for k in sorted(stats.keys()) ])
+ print " ", "".join([ str(stats[k]).ljust(20) for k in sorted(stats.keys()) ])
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Enforces common Android public API design \
patterns. It ignores lint messages from a previous API level, if provided.")
@@ -1520,6 +1560,8 @@
help="Show API changes noticed")
parser.add_argument("--show-deprecations-at-birth", action='store_const', const=True,
help="Show API deprecations at birth")
+ parser.add_argument("--show-stats", action='store_const', const=True,
+ help="Show API stats")
args = vars(parser.parse_args())
if args['no_color']:
@@ -1539,6 +1581,14 @@
show_deprecations_at_birth(cur, prev)
sys.exit()
+ if args['show_stats']:
+ with current_file as f:
+ cur = _parse_stream(f)
+ with previous_file as f:
+ prev = _parse_stream(f)
+ show_stats(cur, prev)
+ sys.exit()
+
with current_file as f:
cur_fail, cur_noticed = examine_stream(f)
if not previous_file is None:
diff --git a/tools/apilint/apilint_stats.sh b/tools/apilint/apilint_stats.sh
new file mode 100755
index 0000000..052d9a5
--- /dev/null
+++ b/tools/apilint/apilint_stats.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+API=28
+while [ $API -gt 14 ]; do
+ echo "# Changes in API $((API))"
+ python tools/apilint/apilint.py --show-stats ../../prebuilts/sdk/$((API))/public/api/android.txt ../../prebuilts/sdk/$((API-1))/public/api/android.txt
+ let API=API-1
+done
diff --git a/tools/stats_log_api_gen/Android.bp b/tools/stats_log_api_gen/Android.bp
index 280afade..703a67b 100644
--- a/tools/stats_log_api_gen/Android.bp
+++ b/tools/stats_log_api_gen/Android.bp
@@ -106,6 +106,7 @@
shared_libs: [
"liblog",
"libutils",
+ "libcutils",
],
static_libs: ["libstatssocket"],
}
diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp
index 1f13cc2..e519909 100644
--- a/tools/stats_log_api_gen/main.cpp
+++ b/tools/stats_log_api_gen/main.cpp
@@ -104,6 +104,7 @@
fprintf(out, "#include <mutex>\n");
fprintf(out, "#include <chrono>\n");
fprintf(out, "#include <thread>\n");
+ fprintf(out, "#include <cutils/properties.h>\n");
fprintf(out, "#include <stats_event_list.h>\n");
fprintf(out, "#include <log/log.h>\n");
fprintf(out, "#include <statslog.h>\n");
@@ -114,6 +115,7 @@
fprintf(out, "namespace util {\n");
fprintf(out, "// the single event tag id for all stats logs\n");
fprintf(out, "const static int kStatsEventTag = 1937006964;\n");
+ fprintf(out, "const static bool kStatsdEnabled = property_get_bool(\"ro.statsd.enable\", true);\n");
std::set<string> kTruncatingAtomNames = {"mobile_radio_power_state_changed",
"audio_state_changed",
@@ -242,6 +244,7 @@
fprintf(out, "{\n");
argIndex = 1;
+ fprintf(out, " if (kStatsdEnabled) {\n");
fprintf(out, " stats_event_list event(kStatsEventTag);\n");
fprintf(out, " event << android::elapsedRealtimeNano();\n\n");
fprintf(out, " event << code;\n\n");
@@ -286,6 +289,9 @@
}
fprintf(out, " return event.write(LOG_ID_STATS);\n");
+ fprintf(out, " } else {\n");
+ fprintf(out, " return 1;\n");
+ fprintf(out, " }\n");
fprintf(out, "}\n");
fprintf(out, "\n");
}
@@ -375,6 +381,7 @@
fprintf(out, "{\n");
argIndex = 1;
+ fprintf(out, " if (kStatsdEnabled) {\n");
fprintf(out, " stats_event_list event(kStatsEventTag);\n");
fprintf(out, " event << android::elapsedRealtimeNano();\n\n");
fprintf(out, " event << code;\n\n");
@@ -398,6 +405,9 @@
}
fprintf(out, " return event.write(LOG_ID_STATS);\n");
+ fprintf(out, " } else {\n");
+ fprintf(out, " return 1;\n");
+ fprintf(out, " }\n");
fprintf(out, "}\n");
fprintf(out, "\n");
}
@@ -1261,4 +1271,4 @@
GOOGLE_PROTOBUF_VERIFY_VERSION;
return android::stats_log_api_gen::run(argc, argv);
-}
\ No newline at end of file
+}