Merge "Drop REASON_SHARED_APK." into oc-dev
diff --git a/Android.mk b/Android.mk
index 8daab8f..eb649c9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1460,7 +1460,8 @@
LOCAL_SRC_FILES := \
$(call all-proto-files-under, core/proto) \
$(call all-proto-files-under, libs/incident/proto)
-include $(BUILD_STATIC_LIBRARY)
+LOCAL_SHARED_LIBRARIES := libprotobuf-cpp-full
+include $(BUILD_SHARED_LIBRARY)
# ==== c++ proto host library ==============================
include $(CLEAR_VARS)
diff --git a/api/current.txt b/api/current.txt
index 5287984..ec2a0e6 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5586,7 +5586,7 @@
method public boolean removeAutomaticZenRule(java.lang.String);
method public final void setInterruptionFilter(int);
method public void setNotificationPolicy(android.app.NotificationManager.Policy);
- method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
+ method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule);
field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
@@ -5641,6 +5641,7 @@
method public java.lang.String getCreatorPackage();
method public int getCreatorUid();
method public android.os.UserHandle getCreatorUserHandle();
+ method public static android.app.PendingIntent getForegroundService(android.content.Context, int, android.content.Intent, int);
method public android.content.IntentSender getIntentSender();
method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
method public deprecated java.lang.String getTargetPackage();
@@ -8858,6 +8859,7 @@
method public abstract void startActivities(android.content.Intent[], android.os.Bundle);
method public abstract void startActivity(android.content.Intent);
method public abstract void startActivity(android.content.Intent, android.os.Bundle);
+ method public abstract android.content.ComponentName startForegroundService(android.content.Intent);
method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -9049,6 +9051,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -40679,6 +40682,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -45161,8 +45165,8 @@
method public void addTouchables(java.util.ArrayList<android.view.View>);
method public android.view.ViewPropertyAnimator animate();
method public void announceForAccessibility(java.lang.CharSequence);
- method public boolean autofill(android.view.autofill.AutofillValue);
- method public boolean autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
+ method public void autofill(android.view.autofill.AutofillValue);
+ method public void autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
method protected boolean awakenScrollBars();
method protected boolean awakenScrollBars(int);
method protected boolean awakenScrollBars(int, boolean);
@@ -48110,7 +48114,8 @@
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ method public android.view.textclassifier.TextClassifier getTextClassifier();
+ method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {
@@ -48147,9 +48152,6 @@
field public static final java.lang.String TYPE_URL = "url";
}
- public static abstract class TextClassifier.EntityType implements java.lang.annotation.Annotation {
- }
-
public final class TextLanguage {
method public float getConfidenceScore(java.util.Locale);
method public int getEndIndex();
diff --git a/api/removed.txt b/api/removed.txt
index 75da976..af429b8 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -380,6 +380,14 @@
}
+package android.view.textclassifier {
+
+ public final class TextClassificationManager {
+ method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ }
+
+}
+
package android.webkit {
public class WebViewClient {
diff --git a/api/system-current.txt b/api/system-current.txt
index bec8d25..2890041 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5312,6 +5312,7 @@
field public static final int DEFAULT_LIGHTS = 4; // 0x4
field public static final int DEFAULT_SOUND = 1; // 0x1
field public static final int DEFAULT_VIBRATE = 2; // 0x2
+ field public static final java.lang.String EXTRA_ALLOW_DURING_SETUP = "android.allowDuringSetup";
field public static final java.lang.String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents";
field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
@@ -5779,7 +5780,7 @@
method public boolean removeAutomaticZenRule(java.lang.String);
method public final void setInterruptionFilter(int);
method public void setNotificationPolicy(android.app.NotificationManager.Policy);
- method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
+ method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule);
field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
@@ -5834,6 +5835,7 @@
method public java.lang.String getCreatorPackage();
method public int getCreatorUid();
method public android.os.UserHandle getCreatorUserHandle();
+ method public static android.app.PendingIntent getForegroundService(android.content.Context, int, android.content.Intent, int);
method public android.content.IntentSender getIntentSender();
method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
method public deprecated java.lang.String getTargetPackage();
@@ -9352,6 +9354,7 @@
method public abstract void startActivities(android.content.Intent[], android.os.Bundle);
method public abstract void startActivity(android.content.Intent);
method public abstract void startActivity(android.content.Intent, android.os.Bundle);
+ method public abstract android.content.ComponentName startForegroundService(android.content.Intent);
method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -9557,6 +9560,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -44116,6 +44120,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -48616,8 +48621,8 @@
method public void addTouchables(java.util.ArrayList<android.view.View>);
method public android.view.ViewPropertyAnimator animate();
method public void announceForAccessibility(java.lang.CharSequence);
- method public boolean autofill(android.view.autofill.AutofillValue);
- method public boolean autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
+ method public void autofill(android.view.autofill.AutofillValue);
+ method public void autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
method protected boolean awakenScrollBars();
method protected boolean awakenScrollBars(int);
method protected boolean awakenScrollBars(int, boolean);
@@ -51568,7 +51573,8 @@
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ method public android.view.textclassifier.TextClassifier getTextClassifier();
+ method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {
@@ -51605,9 +51611,6 @@
field public static final java.lang.String TYPE_URL = "url";
}
- public static abstract class TextClassifier.EntityType implements java.lang.annotation.Annotation {
- }
-
public final class TextLanguage {
method public float getConfidenceScore(java.util.Locale);
method public int getEndIndex();
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 3aa9398..272ae77 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -374,6 +374,14 @@
}
+package android.view.textclassifier {
+
+ public final class TextClassificationManager {
+ method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ }
+
+}
+
package android.webkit {
public class WebViewClient {
diff --git a/api/test-current.txt b/api/test-current.txt
index e9f94d9..69ea620 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -5599,7 +5599,7 @@
method public boolean removeAutomaticZenRule(java.lang.String);
method public final void setInterruptionFilter(int);
method public void setNotificationPolicy(android.app.NotificationManager.Policy);
- method public android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
+ method public deprecated android.content.ComponentName startServiceInForeground(android.content.Intent, int, android.app.Notification);
method public boolean updateAutomaticZenRule(java.lang.String, android.app.AutomaticZenRule);
field public static final java.lang.String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
field public static final java.lang.String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
@@ -5654,6 +5654,7 @@
method public java.lang.String getCreatorPackage();
method public int getCreatorUid();
method public android.os.UserHandle getCreatorUserHandle();
+ method public static android.app.PendingIntent getForegroundService(android.content.Context, int, android.content.Intent, int);
method public android.content.IntentSender getIntentSender();
method public static android.app.PendingIntent getService(android.content.Context, int, android.content.Intent, int);
method public deprecated java.lang.String getTargetPackage();
@@ -8890,6 +8891,7 @@
method public abstract void startActivities(android.content.Intent[], android.os.Bundle);
method public abstract void startActivity(android.content.Intent);
method public abstract void startActivity(android.content.Intent, android.os.Bundle);
+ method public abstract android.content.ComponentName startForegroundService(android.content.Intent);
method public abstract boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public abstract void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -9082,6 +9084,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -40883,6 +40886,7 @@
method public void startActivities(android.content.Intent[], android.os.Bundle);
method public void startActivity(android.content.Intent);
method public void startActivity(android.content.Intent, android.os.Bundle);
+ method public android.content.ComponentName startForegroundService(android.content.Intent);
method public boolean startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle);
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSender(android.content.IntentSender, android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
@@ -45535,8 +45539,8 @@
method public void addTouchables(java.util.ArrayList<android.view.View>);
method public android.view.ViewPropertyAnimator animate();
method public void announceForAccessibility(java.lang.CharSequence);
- method public boolean autofill(android.view.autofill.AutofillValue);
- method public boolean autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
+ method public void autofill(android.view.autofill.AutofillValue);
+ method public void autofill(android.util.SparseArray<android.view.autofill.AutofillValue>);
method protected boolean awakenScrollBars();
method protected boolean awakenScrollBars(int);
method protected boolean awakenScrollBars(int, boolean);
@@ -48493,7 +48497,8 @@
public final class TextClassificationManager {
method public java.util.List<android.view.textclassifier.TextLanguage> detectLanguages(java.lang.CharSequence);
- method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ method public android.view.textclassifier.TextClassifier getTextClassifier();
+ method public void setTextClassifier(android.view.textclassifier.TextClassifier);
}
public final class TextClassificationResult {
@@ -48530,9 +48535,6 @@
field public static final java.lang.String TYPE_URL = "url";
}
- public static abstract class TextClassifier.EntityType implements java.lang.annotation.Annotation {
- }
-
public final class TextLanguage {
method public float getConfidenceScore(java.util.Locale);
method public int getEndIndex();
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 75da976..af429b8 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -380,6 +380,14 @@
}
+package android.view.textclassifier {
+
+ public final class TextClassificationManager {
+ method public android.view.textclassifier.TextClassifier getDefaultTextClassifier();
+ }
+
+}
+
package android.webkit {
public class WebViewClient {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index bace226..147b5d0 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2740,6 +2740,10 @@
return true;
}
return false;
+ } else if (keyCode == KeyEvent.KEYCODE_TAB) {
+ // Don't consume TAB here since it's used for navigation. Arrow keys
+ // aren't considered "typing keys" so they already won't get consumed.
+ return false;
} else {
// Common code for DEFAULT_KEYS_DIALER & DEFAULT_KEYS_SEARCH_*
boolean clearSpannable = false;
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 9f2f669..4004bd6 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -405,6 +405,13 @@
*/
public static final int INTENT_SENDER_SERVICE = 4;
+ /**
+ * Type for IActivityManaqer.getIntentSender: this PendingIntent is
+ * for a startForegroundService operation.
+ * @hide
+ */
+ public static final int INTENT_SENDER_FOREGROUND_SERVICE = 5;
+
/** @hide User operation call: success! */
public static final int USER_OP_SUCCESS = 0;
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 4c080c9..467ba99 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1447,14 +1447,21 @@
@Override
public ComponentName startService(Intent service) {
warnIfCallingFromSystemProcess();
- return startServiceCommon(service, -1, null, mUser);
+ return startServiceCommon(service, -1, null, false, mUser);
}
@Override
+ public ComponentName startForegroundService(Intent service) {
+ warnIfCallingFromSystemProcess();
+ return startServiceCommon(service, -1, null, true, mUser);
+ }
+
+ // STOPSHIP: remove when NotificationManager.startServiceInForeground() is retired
+ @Override
public ComponentName startServiceInForeground(Intent service,
int id, Notification notification) {
warnIfCallingFromSystemProcess();
- return startServiceCommon(service, id, notification, mUser);
+ return startServiceCommon(service, id, notification, false, mUser);
}
@Override
@@ -1465,24 +1472,30 @@
@Override
public ComponentName startServiceAsUser(Intent service, UserHandle user) {
- return startServiceCommon(service, -1, null, user);
+ return startServiceCommon(service, -1, null, false, user);
}
@Override
+ public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) {
+ return startServiceCommon(service, -1, null, true, user);
+ }
+
+ // STOPSHIP: remove when NotificationManager.startServiceInForeground() is retired
+ @Override
public ComponentName startServiceInForegroundAsUser(Intent service,
int id, Notification notification, UserHandle user) {
- return startServiceCommon(service, id, notification, user);
+ return startServiceCommon(service, id, notification, false, user);
}
private ComponentName startServiceCommon(Intent service, int id, Notification notification,
- UserHandle user) {
+ boolean requireForeground, UserHandle user) {
try {
validateServiceIntent(service);
service.prepareToLeaveProcess(this);
ComponentName cn = ActivityManager.getService().startService(
mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(
- getContentResolver()), id, notification, getOpPackageName(),
- user.getIdentifier());
+ getContentResolver()), id, notification, requireForeground,
+ getOpPackageName(), user.getIdentifier());
if (cn != null) {
if (cn.getPackageName().equals("!")) {
throw new SecurityException(
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index b9d1d91..0a5e4be 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -130,7 +130,7 @@
PendingIntent getRunningServiceControlPanel(in ComponentName service);
ComponentName startService(in IApplicationThread caller, in Intent service,
in String resolvedType, int id, in Notification notification,
- in String callingPackage, int userId);
+ boolean requireForeground, in String callingPackage, int userId);
int stopService(in IApplicationThread caller, in Intent service,
in String resolvedType, int userId);
int bindService(in IApplicationThread caller, in IBinder token, in Intent service,
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index c78b3cd..4bbc003 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -971,6 +971,7 @@
* Only available to notifications coming from the android package.
* @hide
*/
+ @SystemApi
public static final String EXTRA_ALLOW_DURING_SETUP = "android.allowDuringSetup";
/**
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 75998f2..72c5978 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -1171,8 +1171,11 @@
* @return If the service is being started or is already running, the
* {@link ComponentName} of the actual service that was started is
* returned; else if the service does not exist null is returned.
+ *
+ * @deprecated STOPSHIP transition away from this for O
*/
@Nullable
+ @Deprecated
public ComponentName startServiceInForeground(Intent service,
int id, Notification notification) {
return mContext.startServiceInForeground(service, id, notification);
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 7d1a16a..dc432af 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -596,6 +596,42 @@
*/
public static PendingIntent getService(Context context, int requestCode,
@NonNull Intent intent, @Flags int flags) {
+ return buildServicePendingIntent(context, requestCode, intent, flags,
+ ActivityManager.INTENT_SENDER_SERVICE);
+ }
+
+ /**
+ * Retrieve a PendingIntent that will start a foreground service, like calling
+ * {@link Context#startService Context.startForegroundService()}. The start
+ * arguments given to the service will come from the extras of the Intent.
+ *
+ * <p class="note">For security reasons, the {@link android.content.Intent}
+ * you supply here should almost always be an <em>explicit intent</em>,
+ * that is specify an explicit component to be delivered to through
+ * {@link Intent#setClass(android.content.Context, Class) Intent.setClass}</p>
+ *
+ * @param context The Context in which this PendingIntent should start
+ * the service.
+ * @param requestCode Private request code for the sender
+ * @param intent An Intent describing the service to be started.
+ * @param flags May be {@link #FLAG_ONE_SHOT}, {@link #FLAG_NO_CREATE},
+ * {@link #FLAG_CANCEL_CURRENT}, {@link #FLAG_UPDATE_CURRENT},
+ * {@link #FLAG_IMMUTABLE} or any of the flags as supported by
+ * {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
+ * of the intent that can be supplied when the actual send happens.
+ *
+ * @return Returns an existing or new PendingIntent matching the given
+ * parameters. May return null only if {@link #FLAG_NO_CREATE} has been
+ * supplied.
+ */
+ public static PendingIntent getForegroundService(Context context, int requestCode,
+ @NonNull Intent intent, @Flags int flags) {
+ return buildServicePendingIntent(context, requestCode, intent, flags,
+ ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE);
+ }
+
+ private static PendingIntent buildServicePendingIntent(Context context, int requestCode,
+ Intent intent, int flags, int serviceKind) {
String packageName = context.getPackageName();
String resolvedType = intent != null ? intent.resolveTypeIfNeeded(
context.getContentResolver()) : null;
@@ -603,7 +639,7 @@
intent.prepareToLeaveProcess(context);
IIntentSender target =
ActivityManager.getService().getIntentSender(
- ActivityManager.INTENT_SENDER_SERVICE, packageName,
+ serviceKind, packageName,
null, null, requestCode, new Intent[] { intent },
resolvedType != null ? new String[] { resolvedType } : null,
flags, null, UserHandle.myUserId());
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 3a8a420..1803bbe 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2576,7 +2576,7 @@
* {@link ComponentName} of the actual service that was started is
* returned; else if the service does not exist null is returned.
*
- * @throws SecurityException If the caller does not permission to access the service
+ * @throws SecurityException If the caller does not have permission to access the service
* or the service can not be found.
* @throws IllegalStateException If the application is in a state where the service
* can not be started (such as not in the foreground in a state when services are allowed).
@@ -2588,11 +2588,47 @@
public abstract ComponentName startService(Intent service);
/**
+ * Similar to {@link #startService(Intent)}, but with an implicit promise that the
+ * Service will call {@link android.app.Service#startForeground(int, Notification)
+ * startForeground(int, Notification)} once it begins running. The service is given
+ * an amount of time comparable to the ANR interval to do this, otherwise the system
+ * will automatically stop the service and declare the app ANR.
+ *
+ * <p>Unlike the ordinary {@link #startService(Intent)}, this method can be used
+ * at any time, regardless of whether the app hosting the service is in a foreground
+ * state.
+ *
+ * @param service Identifies the service to be started. The Intent must be
+ * fully explicit (supplying a component name). Additional values
+ * may be included in the Intent extras to supply arguments along with
+ * this specific start call.
+ *
+ * @return If the service is being started or is already running, the
+ * {@link ComponentName} of the actual service that was started is
+ * returned; else if the service does not exist null is returned.
+ *
+ * @throws SecurityException If the caller does not have permission to access the service
+ * or the service can not be found.
+ *
+ * @see #stopService
+ * @see android.app.Service#startForeground(int, Notification)
+ */
+ @Nullable
+ public abstract ComponentName startForegroundService(Intent service);
+
+ /**
+ * @hide like {@link #startForegroundService(Intent)} but for a specific user.
+ */
+ @Nullable
+ public abstract ComponentName startForegroundServiceAsUser(Intent service, UserHandle user);
+
+ /**
* Start a service directly into the "foreground service" state. Unlike {@link #startService},
* this method can be used from within background operations like broadcast receivers
* or scheduled jobs. The API entry point for this is in NotificationManager in order to
* preserve appropriate public package layering.
* @hide
+ * @deprecated STOPSHIP remove in favor of two-step startForegroundService() + startForeground()
*/
@Nullable
public abstract ComponentName startServiceInForeground(Intent service,
@@ -2620,7 +2656,7 @@
* @return If there is a service matching the given Intent that is already
* running, then it is stopped and {@code true} is returned; else {@code false} is returned.
*
- * @throws SecurityException If the caller does not permission to access the service
+ * @throws SecurityException If the caller does not have permission to access the service
* or the service can not be found.
* @throws IllegalStateException If the application is in a state where the service
* can not be started (such as not in the foreground in a state when services are allowed).
@@ -2638,7 +2674,9 @@
/**
* @hide like {@link #startServiceInForeground(Intent, int, Notification)}
* but for a specific user.
+ * @deprecated STOPSHIP remove when trial API is turned off
*/
+ @Deprecated
@Nullable
public abstract ComponentName startServiceInForegroundAsUser(Intent service,
int id, Notification notification, UserHandle user);
@@ -2685,7 +2723,7 @@
* {@code false} is returned if the connection is not made so you will not
* receive the service object.
*
- * @throws SecurityException If the caller does not permission to access the service
+ * @throws SecurityException If the caller does not have permission to access the service
* or the service can not be found.
*
* @see #unbindService
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 6b0bbfa..75784a6 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -644,7 +644,12 @@
return mBase.startService(service);
}
- /** @hide */
+ @Override
+ public ComponentName startForegroundService(Intent service) {
+ return mBase.startForegroundService(service);
+ }
+
+ /** @hide STOPSHIP remove when trial API is turned down */
@Override
public ComponentName startServiceInForeground(Intent service,
int id, Notification notification) {
@@ -664,6 +669,12 @@
/** @hide */
@Override
+ public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) {
+ return mBase.startForegroundServiceAsUser(service, user);
+ }
+
+ /** @hide STOPSHIP removed when trial API is turned down */
+ @Override
public ComponentName startServiceInForegroundAsUser(Intent service,
int id, Notification notification, UserHandle user) {
return mBase.startServiceInForegroundAsUser(service, id, notification, user);
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 370af17..16d582ef 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -314,4 +314,17 @@
*/
public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType,
int flags, int userId);
+
+ /**
+ * Track the creator of a new isolated uid.
+ * @param isolatedUid The newly created isolated uid.
+ * @param ownerUid The uid of the app that created the isolated process.
+ */
+ public abstract void addIsolatedUid(int isolatedUid, int ownerUid);
+
+ /**
+ * Track removal of an isolated uid.
+ * @param isolatedUid isolated uid that is no longer being used.
+ */
+ public abstract void removeIsolatedUid(int isolatedUid);
}
diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java
index 5fa2461..5f66abd 100644
--- a/core/java/android/os/RecoverySystem.java
+++ b/core/java/android/os/RecoverySystem.java
@@ -741,6 +741,10 @@
int timeTotal = -1;
int uncryptTime = -1;
int sourceVersion = -1;
+ int temperature_start = -1;
+ int temperature_end = -1;
+ int temperature_max = -1;
+
while ((line = in.readLine()) != null) {
// Here is an example of lines in last_install:
// ...
@@ -785,6 +789,12 @@
} else if (line.startsWith("bytes_stashed")) {
bytesStashedInMiB = (bytesStashedInMiB == -1) ? scaled :
bytesStashedInMiB + scaled;
+ } else if (line.startsWith("temperature_start")) {
+ temperature_start = scaled;
+ } else if (line.startsWith("temperature_end")) {
+ temperature_end = scaled;
+ } else if (line.startsWith("temperature_max")) {
+ temperature_max = scaled;
}
}
@@ -804,6 +814,15 @@
if (bytesStashedInMiB != -1) {
MetricsLogger.histogram(context, "ota_stashed_in_MiBs", bytesStashedInMiB);
}
+ if (temperature_start != -1) {
+ MetricsLogger.histogram(context, "ota_temperature_start", temperature_start);
+ }
+ if (temperature_end != -1) {
+ MetricsLogger.histogram(context, "ota_temperature_end", temperature_end);
+ }
+ if (temperature_max != -1) {
+ MetricsLogger.histogram(context, "ota_temperature_max", temperature_max);
+ }
} catch (IOException e) {
Log.e(TAG, "Failed to read lines in last_install", e);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 42575b6..a6bf2d2 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -369,8 +369,10 @@
public static final String DISALLOW_ADD_MANAGED_PROFILE = "no_add_managed_profile";
/**
- * Specifies if a user is disallowed from disabling application
- * verification. The default value is <code>false</code>.
+ * Specifies if a user is disallowed from disabling application verification.
+ * Starting from {@link android.os.Build.VERSION_CODES#O}, application verification
+ * is enforced across all users on the device if a profile owner or device owner sets
+ * this restriction to <code>true</code>. The default value is <code>false</code>.
*
* <p>Key for user restrictions.
* <p>Type: Boolean
diff --git a/core/java/android/view/ContextThemeWrapper.java b/core/java/android/view/ContextThemeWrapper.java
index 86318e9..d3cc175 100644
--- a/core/java/android/view/ContextThemeWrapper.java
+++ b/core/java/android/view/ContextThemeWrapper.java
@@ -36,8 +36,8 @@
/**
* Creates a new context wrapper with no theme and no base context.
- * <p>
- * <stong>Note:</strong> A base context <strong>must</strong> be attached
+ * <p class="note">
+ * <strong>Note:</strong> A base context <strong>must</strong> be attached
* using {@link #attachBaseContext(Context)} before calling any other
* method on the newly constructed context wrapper.
*/
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 519c1e2..1cb563f 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -451,10 +451,6 @@
return nativeGetHandle(mNativeObject);
}
- public boolean getTransformToDisplayInverse() {
- return nativeGetTransformToDisplayInverse(mNativeObject);
- }
-
/** flag the transaction as an animation */
public static void setAnimationTransaction() {
nativeSetAnimationTransaction();
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index e924f77..23fcb55 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -7447,11 +7447,8 @@
* </pre>
*
* @param value value to be autofilled.
- *
- * @return {@code true} if the view was successfully autofilled, {@code false} otherwise
*/
- public boolean autofill(@SuppressWarnings("unused") AutofillValue value) {
- return false;
+ public void autofill(@SuppressWarnings("unused") AutofillValue value) {
}
/**
@@ -7461,12 +7458,8 @@
* {@link #onProvideAutofillVirtualStructure(ViewStructure, int)} for more info.
*
* @param values map of values to be autofilled, keyed by virtual child id.
- *
- * @return {@code true} if the view was successfully autofilled, {@code false} otherwise
*/
- public boolean autofill(
- @NonNull @SuppressWarnings("unused") SparseArray<AutofillValue>values) {
- return false;
+ public void autofill(@NonNull @SuppressWarnings("unused") SparseArray<AutofillValue> values) {
}
/**
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index b4d2c6b..37ca5b3 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -554,9 +554,8 @@
}
valuesByParent.put(id.getVirtualChildId(), value);
} else {
- if (view.autofill(value)) {
- numApplied++;
- }
+ view.autofill(value);
+ numApplied++;
}
}
@@ -564,9 +563,8 @@
for (int i = 0; i < virtualValues.size(); i++) {
final View parent = virtualValues.keyAt(i);
final SparseArray<AutofillValue> childrenValues = virtualValues.valueAt(i);
- if (parent.autofill(childrenValues)) {
- numApplied += childrenValues.size();
- }
+ parent.autofill(childrenValues);
+ numApplied += childrenValues.size();
}
}
diff --git a/core/java/android/view/textclassifier/TextClassificationManager.java b/core/java/android/view/textclassifier/TextClassificationManager.java
index 5487965..0b6021a 100644
--- a/core/java/android/view/textclassifier/TextClassificationManager.java
+++ b/core/java/android/view/textclassifier/TextClassificationManager.java
@@ -17,6 +17,7 @@
package android.view.textclassifier;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.content.Context;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -45,7 +46,7 @@
private final Context mContext;
private ParcelFileDescriptor mLangIdFd;
- private TextClassifier mDefault;
+ private TextClassifier mTextClassifier;
private LangId mLangId;
/** @hide */
@@ -53,15 +54,32 @@
mContext = Preconditions.checkNotNull(context);
}
- /**
- * Returns the default text classifier.
- */
+ // TODO: Remove.
+ /** @removed */
public TextClassifier getDefaultTextClassifier() {
+ return getTextClassifier();
+ }
+
+ /**
+ * Returns the text classifier.
+ */
+ public TextClassifier getTextClassifier() {
synchronized (mTextClassifierLock) {
- if (mDefault == null) {
- mDefault = new TextClassifierImpl(mContext);
+ if (mTextClassifier == null) {
+ mTextClassifier = new TextClassifierImpl(mContext);
}
- return mDefault;
+ return mTextClassifier;
+ }
+ }
+
+ /**
+ * Sets the text classifier.
+ * Set to null to use the system default text classifier.
+ * Set to {@link TextClassifier#NO_OP} to disable text classifier features.
+ */
+ public void setTextClassifier(@Nullable TextClassifier textClassifier) {
+ synchronized (mTextClassifierLock) {
+ mTextClassifier = textClassifier;
}
}
diff --git a/core/java/android/view/textclassifier/TextClassifier.java b/core/java/android/view/textclassifier/TextClassifier.java
index dabbf31..0831e20 100644
--- a/core/java/android/view/textclassifier/TextClassifier.java
+++ b/core/java/android/view/textclassifier/TextClassifier.java
@@ -39,9 +39,10 @@
String TYPE_ADDRESS = "address";
String TYPE_URL = "url";
+ /** @hide */
@Retention(RetentionPolicy.SOURCE)
@StringDef({
- TYPE_OTHER, TYPE_EMAIL, TYPE_PHONE, TYPE_ADDRESS
+ TYPE_OTHER, TYPE_EMAIL, TYPE_PHONE, TYPE_ADDRESS, TYPE_URL
})
@interface EntityType {}
diff --git a/core/java/android/widget/AbsSpinner.java b/core/java/android/widget/AbsSpinner.java
index 8f662ba..352e7de 100644
--- a/core/java/android/widget/AbsSpinner.java
+++ b/core/java/android/widget/AbsSpinner.java
@@ -526,15 +526,15 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (!isEnabled()) return false;
+ public void autofill(AutofillValue value) {
+ if (!isEnabled()) return;
- if (value.isList()) {
- setSelection(value.getListValue());
- } else {
+ if (!value.isList()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
+ return;
}
- return true;
+
+ setSelection(value.getListValue());
}
@Override
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index 9dc61ab..c7ba7b5 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -584,16 +584,15 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (!isEnabled()) return false;
+ public void autofill(AutofillValue value) {
+ if (!isEnabled()) return;
- if (value.isToggle()) {
- setChecked(value.getToggleValue());
- } else {
+ if (!value.isToggle()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
+ return;
}
- return true;
+ setChecked(value.getToggleValue());
}
@Override
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index 7d04f35..463ff58 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -775,16 +775,15 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (!isEnabled()) return false;
+ public void autofill(AutofillValue value) {
+ if (!isEnabled()) return;
- if (value.isDate()) {
- mDelegate.updateDate(value.getDateValue());
- } else {
+ if (!value.isDate()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
+ return;
}
- return true;
+ mDelegate.updateDate(value.getDateValue());
}
@Override
diff --git a/core/java/android/widget/RadioGroup.java b/core/java/android/widget/RadioGroup.java
index a7574c7..08e6575 100644
--- a/core/java/android/widget/RadioGroup.java
+++ b/core/java/android/widget/RadioGroup.java
@@ -426,24 +426,22 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (!isEnabled()) return false;
+ public void autofill(AutofillValue value) {
+ if (!isEnabled()) return;
- int index;
- if (value.isList()) {
- index = value.getListValue();
- } else {
+ if (!value.isList()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
- return false;
+ return;
}
+ final int index = value.getListValue();
final View child = getChildAt(index);
if (child == null) {
Log.w(VIEW_LOG_TAG, "RadioGroup.autoFill(): no child with index " + index);
- return false;
+ return;
}
+
check(child.getId());
- return true;
}
@Override
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index bc7c79d..3d5e81b 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -10050,17 +10050,13 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (value.isText()) {
- if (isTextEditable()) {
- setText(value.getTextValue(), mBufferType, true, 0);
- return true;
- }
- } else {
+ public void autofill(AutofillValue value) {
+ if (!value.isText() || !isTextEditable()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
+ return;
}
- return false;
+ setText(value.getTextValue(), mBufferType, true, 0);
}
@Override
@@ -10769,7 +10765,7 @@
TextClassificationManager tcm =
mContext.getSystemService(TextClassificationManager.class);
if (tcm != null) {
- mTextClassifier = tcm.getDefaultTextClassifier();
+ mTextClassifier = tcm.getTextClassifier();
} else {
mTextClassifier = TextClassifier.NO_OP;
}
diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java
index 1e97e3b..0289dad 100644
--- a/core/java/android/widget/TimePicker.java
+++ b/core/java/android/widget/TimePicker.java
@@ -530,16 +530,14 @@
}
@Override
- public boolean autofill(AutofillValue value) {
- if (!isEnabled()) return false;
+ public void autofill(AutofillValue value) {
+ if (!isEnabled()) return;
- if (value.isDate()) {
- mDelegate.setDate(value.getDateValue());
- } else {
+ if (!value.isDate()) {
Log.w(LOG_TAG, value + " could not be autofilled into " + this);
}
- return true;
+ mDelegate.setDate(value.getDateValue());
}
@Override
diff --git a/core/java/com/android/internal/app/ToolbarActionBar.java b/core/java/com/android/internal/app/ToolbarActionBar.java
index 7ce5fc3..b3904f4 100644
--- a/core/java/com/android/internal/app/ToolbarActionBar.java
+++ b/core/java/com/android/internal/app/ToolbarActionBar.java
@@ -477,12 +477,9 @@
final KeyCharacterMap kmap = KeyCharacterMap.load(
event != null ? event.getDeviceId() : KeyCharacterMap.VIRTUAL_KEYBOARD);
menu.setQwertyMode(kmap.getKeyboardType() != KeyCharacterMap.NUMERIC);
- menu.performShortcut(keyCode, event, 0);
+ return menu.performShortcut(keyCode, event, 0);
}
- // This action bar always returns true for handling keyboard shortcuts.
- // This will block the window from preparing a temporary panel to handle
- // keyboard shortcuts.
- return true;
+ return false;
}
@Override
@@ -525,6 +522,17 @@
}
return result;
}
+
+ @Override
+ public View onCreatePanelView(int featureId) {
+ if (featureId == Window.FEATURE_OPTIONS_PANEL) {
+ // This gets called by PhoneWindow.preparePanel. Since this already manages
+ // its own panel, we return a dummy view here to prevent PhoneWindow from
+ // preparing a default one.
+ return new View(mDecorToolbar.getContext());
+ }
+ return super.onCreatePanelView(featureId);
+ }
}
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 3d0d6bf..a0dafdd 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -10057,6 +10057,9 @@
public void setBatteryStateLocked(int status, int health, int plugType, int level,
int temp, int volt, int chargeUAh, int chargeFullUAh) {
+ // Temperature is encoded without the signed bit, so clamp any negative temperatures to 0.
+ temp = Math.max(0, temp);
+
final boolean onBattery = plugType == BATTERY_PLUGGED_NONE;
final long uptime = mClocks.uptimeMillis();
final long elapsedRealtime = mClocks.elapsedRealtime();
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 6fbf49b..e2443bb 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -735,16 +735,6 @@
return javaObjectForIBinder(env, ctrl->getHandle());
}
-static jboolean nativeGetTransformToDisplayInverse(JNIEnv* env, jclass clazz, jlong nativeObject) {
- bool out = false;
- auto ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
- status_t status = ctrl->getTransformToDisplayInverse(&out);
- if (status != NO_ERROR) {
- return false;
- }
- return out;
-}
-
static jobject nativeGetHdrCapabilities(JNIEnv* env, jclass clazz, jobject tokenObject) {
sp<IBinder> token(ibinderForJavaObject(env, tokenObject));
if (token == NULL) return NULL;
@@ -854,8 +844,6 @@
(void*)nativeSetOverrideScalingMode },
{"nativeGetHandle", "(J)Landroid/os/IBinder;",
(void*)nativeGetHandle },
- {"nativeGetTransformToDisplayInverse", "(J)Z",
- (void*)nativeGetTransformToDisplayInverse },
{"nativeScreenshotToBuffer",
"(Landroid/os/IBinder;Landroid/graphics/Rect;IIIIZZI)Landroid/graphics/GraphicBuffer;",
(void*)nativeScreenshotToBuffer },
diff --git a/libs/hwui/hwui_static_deps.mk b/libs/hwui/hwui_static_deps.mk
index 8826cfc..7f06421 100644
--- a/libs/hwui/hwui_static_deps.mk
+++ b/libs/hwui/hwui_static_deps.mk
@@ -27,7 +27,5 @@
libft2 \
libminikin \
libandroidfw \
- libRScpp
-
-LOCAL_STATIC_LIBRARIES += \
+ libRScpp \
libplatformprotos
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 ec80745..297fe67 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivity.java
@@ -17,6 +17,7 @@
package com.android.systemui.pip.phone;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_ACTIONS;
+import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_ALLOW_TIMEOUT;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_CONTROLLER_MESSENGER;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_DISMISS_FRACTION;
import static com.android.systemui.pip.phone.PipMenuActivityController.EXTRA_MOVEMENT_BOUNDS;
@@ -75,8 +76,8 @@
public static final int MESSAGE_UPDATE_ACTIONS = 4;
public static final int MESSAGE_UPDATE_DISMISS_FRACTION = 5;
- private static final long INITIAL_DISMISS_DELAY = 2000;
- private static final long POST_INTERACTION_DISMISS_DELAY = 1500;
+ private static final long INITIAL_DISMISS_DELAY = 3500;
+ private static final long POST_INTERACTION_DISMISS_DELAY = 2000;
private static final long MENU_FADE_DURATION = 125;
private static final float MENU_BACKGROUND_ALPHA = 0.3f;
@@ -116,7 +117,8 @@
case MESSAGE_SHOW_MENU: {
final Bundle data = (Bundle) msg.obj;
showMenu(data.getParcelable(EXTRA_STACK_BOUNDS),
- data.getParcelable(EXTRA_MOVEMENT_BOUNDS));
+ data.getParcelable(EXTRA_MOVEMENT_BOUNDS),
+ data.getBoolean(EXTRA_ALLOW_TIMEOUT));
break;
}
case MESSAGE_POKE_MENU:
@@ -252,7 +254,7 @@
// Do nothing
}
- private void showMenu(Rect stackBounds, Rect movementBounds) {
+ private void showMenu(Rect stackBounds, Rect movementBounds, boolean allowMenuTimeout) {
if (!mMenuVisible) {
updateActionViews(stackBounds);
if (mMenuContainerAnimator != null) {
@@ -265,18 +267,22 @@
mMenuContainer.getAlpha(), 1f);
mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN);
mMenuContainerAnimator.setDuration(MENU_FADE_DURATION);
- mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- repostDelayedFinish(INITIAL_DISMISS_DELAY);
- }
- });
+ if (allowMenuTimeout) {
+ mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ repostDelayedFinish(INITIAL_DISMISS_DELAY);
+ }
+ });
+ }
mMenuContainerAnimator.addUpdateListener(mMenuBgUpdateListener);
mMenuContainerAnimator.start();
} else {
// If we are already visible, then just start the delayed dismiss and unregister any
// existing input consumers from the previous drag
- repostDelayedFinish(POST_INTERACTION_DISMISS_DELAY);
+ if (allowMenuTimeout) {
+ repostDelayedFinish(POST_INTERACTION_DISMISS_DELAY);
+ }
notifyUnregisterInputConsumer();
}
}
@@ -320,7 +326,8 @@
if (intent.getBooleanExtra(EXTRA_SHOW_MENU, false)) {
Rect stackBounds = intent.getParcelableExtra(EXTRA_STACK_BOUNDS);
Rect movementBounds = intent.getParcelableExtra(EXTRA_MOVEMENT_BOUNDS);
- showMenu(stackBounds, movementBounds);
+ boolean allowMenuTimeout = intent.getBooleanExtra(EXTRA_ALLOW_TIMEOUT, true);
+ showMenu(stackBounds, movementBounds, allowMenuTimeout);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
index e2069e2..bcaa395 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipMenuActivityController.java
@@ -33,7 +33,6 @@
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
-import android.util.Pair;
import android.view.IWindowManager;
import com.android.systemui.pip.phone.PipMediaController.ActionListener;
@@ -56,6 +55,7 @@
public static final String EXTRA_ACTIONS = "actions";
public static final String EXTRA_STACK_BOUNDS = "stack_bounds";
public static final String EXTRA_MOVEMENT_BOUNDS = "movement_bounds";
+ public static final String EXTRA_ALLOW_TIMEOUT = "allow_timeout";
public static final String EXTRA_SHOW_MENU = "show_menu";
public static final String EXTRA_DISMISS_FRACTION = "dismiss_fraction";
@@ -105,7 +105,8 @@
private ParceledListSlice mMediaActions;
private boolean mMenuVisible;
- private Bundle mTmpData = new Bundle();
+ // The dismiss fraction update is sent frequently, so use a temporary bundle for the message
+ private Bundle mTmpDismissFractionData = new Bundle();
private boolean mStartActivityRequested;
private Messenger mToActivityMessenger;
@@ -195,11 +196,11 @@
*/
public void setDismissFraction(float fraction) {
if (mToActivityMessenger != null) {
- mTmpData.clear();
- mTmpData.putFloat(EXTRA_DISMISS_FRACTION, fraction);
+ mTmpDismissFractionData.clear();
+ mTmpDismissFractionData.putFloat(EXTRA_DISMISS_FRACTION, fraction);
Message m = Message.obtain();
m.what = PipMenuActivity.MESSAGE_UPDATE_DISMISS_FRACTION;
- m.obj = mTmpData;
+ m.obj = mTmpDismissFractionData;
try {
mToActivityMessenger.send(m);
} catch (RemoteException e) {
@@ -207,28 +208,29 @@
}
} else if (!mStartActivityRequested) {
startMenuActivity(null /* stackBounds */, null /* movementBounds */,
- false /* showMenu */);
+ false /* showMenu */, false /* allowMenuTimeout */);
}
}
/**
* Shows the menu activity.
*/
- public void showMenu(Rect stackBounds, Rect movementBounds) {
+ public void showMenu(Rect stackBounds, Rect movementBounds, boolean allowMenuTimeout) {
if (mToActivityMessenger != null) {
- mTmpData.clear();
- mTmpData.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
- mTmpData.putParcelable(EXTRA_MOVEMENT_BOUNDS, movementBounds);
+ Bundle data = new Bundle();
+ data.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
+ data.putParcelable(EXTRA_MOVEMENT_BOUNDS, movementBounds);
+ data.putBoolean(EXTRA_ALLOW_TIMEOUT, allowMenuTimeout);
Message m = Message.obtain();
m.what = PipMenuActivity.MESSAGE_SHOW_MENU;
- m.obj = mTmpData;
+ m.obj = data;
try {
mToActivityMessenger.send(m);
} catch (RemoteException e) {
Log.e(TAG, "Could not notify menu to show", e);
}
} else if (!mStartActivityRequested) {
- startMenuActivity(stackBounds, movementBounds, true /* showMenu */);
+ startMenuActivity(stackBounds, movementBounds, true /* showMenu */, allowMenuTimeout);
}
}
@@ -290,7 +292,8 @@
/**
* Starts the menu activity on the top task of the pinned stack.
*/
- private void startMenuActivity(Rect stackBounds, Rect movementBounds, boolean showMenu) {
+ private void startMenuActivity(Rect stackBounds, Rect movementBounds, boolean showMenu,
+ boolean allowMenuTimeout) {
try {
StackInfo pinnedStackInfo = mActivityManager.getStackInfo(PINNED_STACK_ID);
if (pinnedStackInfo != null && pinnedStackInfo.taskIds != null &&
@@ -305,6 +308,7 @@
intent.putExtra(EXTRA_MOVEMENT_BOUNDS, movementBounds);
}
intent.putExtra(EXTRA_SHOW_MENU, showMenu);
+ intent.putExtra(EXTRA_ALLOW_TIMEOUT, allowMenuTimeout);
ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0);
options.setLaunchTaskId(
pinnedStackInfo.taskIds[pinnedStackInfo.taskIds.length - 1]);
@@ -336,12 +340,12 @@
Log.e(TAG, "Error showing PIP menu activity", e);
}
- mTmpData.clear();
- mTmpData.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
- mTmpData.putParcelable(EXTRA_ACTIONS, resolveMenuActions());
+ Bundle data = new Bundle();
+ data.putParcelable(EXTRA_STACK_BOUNDS, stackBounds);
+ data.putParcelable(EXTRA_ACTIONS, resolveMenuActions());
Message m = Message.obtain();
m.what = PipMenuActivity.MESSAGE_UPDATE_ACTIONS;
- m.obj = mTmpData;
+ m.obj = data;
try {
mToActivityMessenger.send(m);
} catch (RemoteException e) {
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index a0f491f..0ce3210 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -288,7 +288,8 @@
}
private void onAccessibilityShowMenu() {
- mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds);
+ mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds,
+ false /* allowMenuTimeout */);
}
private boolean handleTouchEvent(MotionEvent ev) {
@@ -617,7 +618,8 @@
// If the menu is still visible, and we aren't minimized, then just poke the menu
// so that it will timeout after the user stops touching it
if (mMenuController.isMenuVisible()) {
- mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds);
+ mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds,
+ true /* allowMenuTimeout */);
}
if (isFling) {
@@ -631,7 +633,8 @@
mMotionHelper.animateToClosestSnapTarget(mMovementBounds, null /* listener */);
setMinimizedStateInternal(false);
} else if (!mIsMenuVisible) {
- mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds);
+ mMenuController.showMenu(mMotionHelper.getBounds(), mMovementBounds,
+ true /* allowMenuTimeout */);
} else {
mMotionHelper.expandPip();
}
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index 98242f9..fd44794 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -679,7 +679,7 @@
pw.println("Battery service (battery) commands:");
pw.println(" help");
pw.println(" Print this help text.");
- pw.println(" set [-f] [ac|usb|wireless|status|level|present|invalid] <value>");
+ pw.println(" set [-f] [ac|usb|wireless|status|level|temp|present|invalid] <value>");
pw.println(" Force a battery property value, freezing battery state.");
pw.println(" -f: force a battery change broadcast be sent, prints new sequence.");
pw.println(" unplug [-f]");
@@ -767,6 +767,9 @@
case "level":
mBatteryProps.batteryLevel = Integer.parseInt(value);
break;
+ case "temp":
+ mBatteryProps.batteryTemperature = Integer.parseInt(value);
+ break;
case "invalid":
mInvalidCharger = Integer.parseInt(value);
break;
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 0ccaf8e..625e4a5 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -1597,17 +1597,11 @@
@Override
public void run() throws RemoteException {
// Confirm that the owner's account still exists before this step.
- UserAccounts owner = getUserAccounts(parentUserId);
- synchronized (owner.dbLock) {
- synchronized (owner.cacheLock) {
- for (Account acc : getAccounts(parentUserId,
- mContext.getOpPackageName())) {
- if (acc.equals(account)) {
- mAuthenticator.addAccountFromCredentials(
- this, account, accountCredentials);
- break;
- }
- }
+ for (Account acc : getAccounts(parentUserId, mContext.getOpPackageName())) {
+ if (acc.equals(account)) {
+ mAuthenticator.addAccountFromCredentials(
+ this, account, accountCredentials);
+ break;
}
}
}
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index b4f8f61..8b0665c 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -17,7 +17,6 @@
package com.android.server.am;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static com.android.server.am.ActivityManagerDebugConfig.*;
import java.io.FileDescriptor;
@@ -96,6 +95,10 @@
// How long we wait for a service to finish executing.
static final int SERVICE_BACKGROUND_TIMEOUT = SERVICE_TIMEOUT * 10;
+ // How long the startForegroundService() grace period is to get around to
+ // calling startForeground() before we ANR + stop it.
+ static final int SERVICE_START_FOREGROUND_TIMEOUT = 5*1000;
+
// How long a service needs to be running until restarting its process
// is no longer considered to be a relaunch of the service.
static final int SERVICE_RESTART_DURATION = 1*1000;
@@ -307,8 +310,8 @@
}
ComponentName startServiceLocked(IApplicationThread caller, Intent service, String resolvedType,
- int id, Notification notification,
- int callingPid, int callingUid, String callingPackage, final int userId)
+ int id, Notification notification, int callingPid, int callingUid,
+ boolean fgRequired, String callingPackage, final int userId)
throws TransactionTooLargeException {
if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "startService: " + service
+ " type=" + resolvedType + " args=" + service.getExtras());
@@ -345,8 +348,9 @@
return null;
}
- // Non-null notification means this is a start directly into the foreground
- if (!r.startRequested && notification == null) {
+ // If this isn't a direct-to-foreground start, check our ability to kick off an
+ // arbitrary service
+ if (!r.startRequested && !fgRequired) {
final long token = Binder.clearCallingIdentity();
try {
// Before going further -- if this app is not allowed to start services in the
@@ -392,12 +396,13 @@
r.lastActivity = SystemClock.uptimeMillis();
r.startRequested = true;
r.delayedStop = false;
+ r.fgRequired = fgRequired;
r.pendingStarts.add(new ServiceRecord.StartItem(r, false, r.makeNextStartId(),
service, neededGrants));
final ServiceMap smap = getServiceMapLocked(r.userId);
boolean addToStarting = false;
- if (!callerFg && r.app == null
+ if (!callerFg && !fgRequired && r.app == null
&& mAm.mUserController.hasStartedUserState(r.userId)) {
ProcessRecord proc = mAm.getProcessRecordLocked(r.processName, r.appInfo.uid, false);
if (proc == null || proc.curProcState > ActivityManager.PROCESS_STATE_RECEIVER) {
@@ -449,9 +454,9 @@
Slog.v(TAG_SERVICE, sb.toString());
}
} else if (DEBUG_DELAYED_STARTS) {
- if (callerFg) {
+ if (callerFg || fgRequired) {
Slog.v(TAG_SERVICE, "Not potential delay (callerFg=" + callerFg + " uid="
- + callingUid + " pid=" + callingPid + "): " + r);
+ + callingUid + " pid=" + callingPid + " fgRequired=" + fgRequired + "): " + r);
} else if (r.app != null) {
Slog.v(TAG_SERVICE, "Not potential delay (cur app=" + r.app + "): " + r);
} else {
@@ -461,6 +466,7 @@
}
ComponentName cmp = startServiceInnerLocked(smap, service, r, callerFg, addToStarting);
+ // STOPSHIP deprecated; remove when NotificationManager.startServiceInForeground is retired
if (notification != null) {
setServiceForegroundInnerLocked(r, id, notification, 0);
}
@@ -540,7 +546,7 @@
if (first) {
smap.rescheduleDelayedStartsLocked();
}
- } else if (callerFg) {
+ } else if (callerFg || r.fgRequired) {
smap.ensureNotStartingBackgroundLocked(r);
}
@@ -756,8 +762,17 @@
}
}
}
+ if (r.fgRequired) {
+ if (DEBUG_BACKGROUND_CHECK) {
+ Slog.i(TAG, "Service called startForeground() as required: " + r);
+ }
+ r.fgRequired = false;
+ r.fgWaiting = false;
+ mAm.mHandler.removeMessages(
+ ActivityManagerService.SERVICE_FOREGROUND_TIMEOUT_MSG, r);
+ }
if (r.foregroundId != id) {
- cancelForegroudNotificationLocked(r);
+ cancelForegroundNotificationLocked(r);
r.foregroundId = id;
}
notification.flags |= Notification.FLAG_FOREGROUND_SERVICE;
@@ -779,7 +794,7 @@
}
}
if ((flags & Service.STOP_FOREGROUND_REMOVE) != 0) {
- cancelForegroudNotificationLocked(r);
+ cancelForegroundNotificationLocked(r);
r.foregroundId = 0;
r.foregroundNoti = null;
} else if (r.appInfo.targetSdkVersion >= Build.VERSION_CODES.LOLLIPOP) {
@@ -792,7 +807,7 @@
}
}
- private void cancelForegroudNotificationLocked(ServiceRecord r) {
+ private void cancelForegroundNotificationLocked(ServiceRecord r) {
if (r.foregroundId != 0) {
// First check to see if this app has any other active foreground services
// with the same notification ID. If so, we shouldn't actually cancel it,
@@ -1631,7 +1646,7 @@
r.makeRestarting(mAm.mProcessStats.getMemFactorLocked(), now);
}
- cancelForegroudNotificationLocked(r);
+ cancelForegroundNotificationLocked(r);
mAm.mHandler.removeCallbacks(r.restarter);
mAm.mHandler.postAtTime(r.restarter, r.nextRestartTime);
@@ -1718,7 +1733,9 @@
return null;
}
- if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bringing up " + r + " " + r.intent);
+ if (DEBUG_SERVICE) {
+ Slog.v(TAG_SERVICE, "Bringing up " + r + " " + r.intent + " fg=" + r.fgRequired);
+ }
// We are now bringing the service up, so no longer in the
// restarting state.
@@ -1944,8 +1961,10 @@
ServiceRecord.StartItem si = null;
try {
si = r.pendingStarts.remove(0);
- if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Sending arguments to: "
- + r + " " + r.intent + " args=" + si.intent);
+ if (DEBUG_SERVICE) {
+ Slog.v(TAG_SERVICE, "Sending arguments to: "
+ + r + " " + r.intent + " args=" + si.intent);
+ }
if (si.intent == null && N > 1) {
// If somehow we got a dummy null intent in the middle,
// then skip it. DO NOT skip a null intent when it is
@@ -1966,6 +1985,19 @@
oomAdjusted = true;
mAm.updateOomAdjLocked(r.app);
}
+ if (r.fgRequired && !r.fgWaiting) {
+ if (!r.isForeground) {
+ if (DEBUG_BACKGROUND_CHECK) {
+ Slog.i(TAG, "Launched service must call startForeground() within timeout: " + r);
+ }
+ scheduleServiceForegroundTransitionTimeoutLocked(r);
+ } else {
+ if (DEBUG_BACKGROUND_CHECK) {
+ Slog.i(TAG, "Service already foreground; no new timeout: " + r);
+ }
+ r.fgRequired = false;
+ }
+ }
int flags = 0;
if (si.deliveryCount > 1) {
flags |= Service.START_FLAG_RETRY;
@@ -2101,7 +2133,7 @@
}
}
- cancelForegroudNotificationLocked(r);
+ cancelForegroundNotificationLocked(r);
r.isForeground = false;
r.foregroundId = 0;
r.foregroundNoti = null;
@@ -2925,23 +2957,53 @@
}
}
+ void serviceForegroundTimeout(ServiceRecord r) {
+ ProcessRecord app;
+ synchronized (mAm) {
+ if (!r.fgRequired) {
+ return;
+ }
+
+ if (DEBUG_BACKGROUND_CHECK) {
+ Slog.i(TAG, "Service foreground-required timeout for " + r);
+ }
+ app = r.app;
+ r.fgWaiting = false;
+ stopServiceLocked(r);
+ }
+
+ if (app != null) {
+ mAm.mAppErrors.appNotResponding(app, null, null, false,
+ "Context.startForegroundService() did not then call Service.startForeground()");
+ }
+ }
+
void scheduleServiceTimeoutLocked(ProcessRecord proc) {
if (proc.executingServices.size() == 0 || proc.thread == null) {
return;
}
- long now = SystemClock.uptimeMillis();
Message msg = mAm.mHandler.obtainMessage(
ActivityManagerService.SERVICE_TIMEOUT_MSG);
msg.obj = proc;
- mAm.mHandler.sendMessageAtTime(msg,
- proc.execServicesFg ? (now+SERVICE_TIMEOUT) : (now+ SERVICE_BACKGROUND_TIMEOUT));
+ mAm.mHandler.sendMessageDelayed(msg,
+ proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
+ }
+
+ void scheduleServiceForegroundTransitionTimeoutLocked(ServiceRecord r) {
+ if (r.app.executingServices.size() == 0 || r.app.thread == null) {
+ return;
+ }
+ Message msg = mAm.mHandler.obtainMessage(
+ ActivityManagerService.SERVICE_FOREGROUND_TIMEOUT_MSG);
+ msg.obj = r;
+ r.fgWaiting = true;
+ mAm.mHandler.sendMessageDelayed(msg, SERVICE_START_FOREGROUND_TIMEOUT);
}
final class ServiceDumper {
private final FileDescriptor fd;
private final PrintWriter pw;
private final String[] args;
- private final int opti;
private final boolean dumpAll;
private final String dumpPackage;
private final ItemMatcher matcher;
@@ -2962,7 +3024,6 @@
this.fd = fd;
this.pw = pw;
this.args = args;
- this.opti = opti;
this.dumpAll = dumpAll;
this.dumpPackage = dumpPackage;
matcher = new ItemMatcher();
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 8cb0eee..b4da152 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1726,6 +1726,7 @@
static final int HANDLE_TRUST_STORAGE_UPDATE_MSG = 63;
static final int REPORT_LOCKED_BOOT_COMPLETE_MSG = 64;
static final int NOTIFY_VR_SLEEPING_MSG = 65;
+ static final int SERVICE_FOREGROUND_TIMEOUT_MSG = 66;
static final int START_USER_SWITCH_FG_MSG = 712;
static final int FIRST_ACTIVITY_STACK_MSG = 100;
@@ -1991,6 +1992,9 @@
}
mServices.serviceTimeout((ProcessRecord)msg.obj);
} break;
+ case SERVICE_FOREGROUND_TIMEOUT_MSG: {
+ mServices.serviceForegroundTimeout((ServiceRecord)msg.obj);
+ } break;
case UPDATE_TIME_ZONE: {
synchronized (ActivityManagerService.this) {
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
@@ -6596,6 +6600,7 @@
mBatteryStatsService.noteProcessFinish(app.processName, app.info.uid);
if (app.isolated) {
mBatteryStatsService.removeIsolatedUid(app.uid, app.info.uid);
+ getPackageManagerInternalLocked().removeIsolatedUid(app.uid);
}
boolean willRestart = false;
if (app.persistent && !app.isolated) {
@@ -12089,6 +12094,7 @@
// the uid of the isolated process is specified by the caller.
uid = isolatedUid;
}
+ getPackageManagerInternalLocked().addIsolatedUid(uid, info.uid);
// Register the isolated UID with this application so BatteryStats knows to
// attribute resource usage to the application.
@@ -17896,7 +17902,7 @@
@Override
public ComponentName startService(IApplicationThread caller, Intent service,
- String resolvedType, int id, Notification notification,
+ String resolvedType, int id, Notification notification, boolean requireForeground,
String callingPackage, int userId)
throws TransactionTooLargeException {
enforceNotIsolatedCaller("startService");
@@ -17910,28 +17916,28 @@
}
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE,
- "startService: " + service + " type=" + resolvedType);
+ "*** startService: " + service + " type=" + resolvedType + " fg=" + requireForeground);
synchronized(this) {
final int callingPid = Binder.getCallingPid();
final int callingUid = Binder.getCallingUid();
final long origId = Binder.clearCallingIdentity();
ComponentName res = mServices.startServiceLocked(caller, service,
- resolvedType, id, notification,
- callingPid, callingUid, callingPackage, userId);
+ resolvedType, id, notification, callingPid, callingUid,
+ requireForeground, callingPackage, userId);
Binder.restoreCallingIdentity(origId);
return res;
}
}
ComponentName startServiceInPackage(int uid, Intent service, String resolvedType,
- String callingPackage, int userId)
+ boolean fgRequired, String callingPackage, int userId)
throws TransactionTooLargeException {
synchronized(this) {
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE,
"startServiceInPackage: " + service + " type=" + resolvedType);
final long origId = Binder.clearCallingIdentity();
ComponentName res = mServices.startServiceLocked(null, service,
- resolvedType, 0, null, -1, uid, callingPackage, userId);
+ resolvedType, 0, null, -1, uid, fgRequired, callingPackage, userId);
Binder.restoreCallingIdentity(origId);
return res;
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
index 9b6d13a..a9bd872 100644
--- a/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
+++ b/services/core/java/com/android/server/am/ActivityManagerShellCommand.java
@@ -519,7 +519,7 @@
pw.println("Starting service: " + intent);
pw.flush();
ComponentName cn = mInterface.startService(null, intent, intent.getType(),
- -1, null, SHELL_PACKAGE_NAME, mUserId);
+ -1, null, false, SHELL_PACKAGE_NAME, mUserId);
if (cn == null) {
err.println("Error: Not found; no service started.");
return -1;
diff --git a/services/core/java/com/android/server/am/PendingIntentRecord.java b/services/core/java/com/android/server/am/PendingIntentRecord.java
index c494171..f05bfb6 100644
--- a/services/core/java/com/android/server/am/PendingIntentRecord.java
+++ b/services/core/java/com/android/server/am/PendingIntentRecord.java
@@ -175,6 +175,8 @@
return "broadcastIntent";
case ActivityManager.INTENT_SENDER_SERVICE:
return "startService";
+ case ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE:
+ return "startForegroundService";
case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
return "activityResult";
}
@@ -318,9 +320,11 @@
}
break;
case ActivityManager.INTENT_SENDER_SERVICE:
+ case ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE:
try {
- owner.startServiceInPackage(uid, finalIntent,
- resolvedType, key.packageName, userId);
+ owner.startServiceInPackage(uid, finalIntent, resolvedType,
+ key.type == ActivityManager.INTENT_SENDER_FOREGROUND_SERVICE,
+ key.packageName, userId);
} catch (RuntimeException e) {
Slog.w(TAG, "Unable to send startService intent", e);
} catch (TransactionTooLargeException e) {
diff --git a/services/core/java/com/android/server/am/ServiceRecord.java b/services/core/java/com/android/server/am/ServiceRecord.java
index dfbe59f..44ebf50 100644
--- a/services/core/java/com/android/server/am/ServiceRecord.java
+++ b/services/core/java/com/android/server/am/ServiceRecord.java
@@ -92,6 +92,8 @@
ServiceState restartTracker; // tracking service restart
boolean whitelistManager; // any bindings to this service have BIND_ALLOW_WHITELIST_MANAGEMENT?
boolean delayed; // are we waiting to start this service in the background?
+ boolean fgRequired; // is the service required to go foreground after starting?
+ boolean fgWaiting; // is a timeout for going foreground already scheduled?
boolean isForeground; // is service currently in foreground mode?
int foregroundId; // Notification ID of last foreground req.
Notification foregroundNoti; // Notification record of foreground state.
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 43558af..a045e5b 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -650,6 +650,11 @@
final ArrayMap<String, Set<String>> mKnownCodebase =
new ArrayMap<String, Set<String>>();
+ // Keys are isolated uids and values are the uid of the application
+ // that created the isolated proccess.
+ @GuardedBy("mPackages")
+ final SparseIntArray mIsolatedOwners = new SparseIntArray();
+
// List of APK paths to load for each user and package. This data is never
// persisted by the package manager. Instead, the overlay manager will
// ensure the data is up-to-date in runtime.
@@ -6121,6 +6126,10 @@
* instant, returns {@code null}.
*/
private String getInstantAppPackageName(int callingUid) {
+ // If the caller is an isolated app use the owner's uid for the lookup.
+ if (Process.isIsolated(callingUid)) {
+ callingUid = mIsolatedOwners.get(callingUid);
+ }
final int appId = UserHandle.getAppId(callingUid);
synchronized (mPackages) {
final Object obj = mSettings.getUserIdLPr(appId);
@@ -7293,17 +7302,22 @@
if (HIDE_EPHEMERAL_APIS || isEphemeralDisabled()) {
return false;
}
+ int uid = Binder.getCallingUid();
+ if (Process.isIsolated(uid)) {
+ uid = mIsolatedOwners.get(uid);
+ }
synchronized (mPackages) {
final PackageSetting ps = mSettings.mPackages.get(packageName);
+ PackageParser.Package pkg = mPackages.get(packageName);
final boolean returnAllowed =
ps != null
- && (isCallerSameApp(packageName)
+ && (isCallerSameApp(packageName, uid)
|| mContext.checkCallingOrSelfPermission(
android.Manifest.permission.ACCESS_INSTANT_APPS)
== PERMISSION_GRANTED
|| mInstantAppRegistry.isInstantAccessGranted(
- userId, UserHandle.getAppId(Binder.getCallingUid()), ps.appId));
+ userId, UserHandle.getAppId(uid), ps.appId));
if (returnAllowed) {
return ps.getInstantApp(userId);
}
@@ -7320,7 +7334,7 @@
enforceCrossUserPermission(Binder.getCallingUid(), userId,
true /* requireFullPermission */, false /* checkShell */,
"getInstantAppCookie");
- if (!isCallerSameApp(packageName)) {
+ if (!isCallerSameApp(packageName, Binder.getCallingUid())) {
return null;
}
synchronized (mPackages) {
@@ -7338,7 +7352,7 @@
enforceCrossUserPermission(Binder.getCallingUid(), userId,
true /* requireFullPermission */, true /* checkShell */,
"setInstantAppCookie");
- if (!isCallerSameApp(packageName)) {
+ if (!isCallerSameApp(packageName, Binder.getCallingUid())) {
return false;
}
synchronized (mPackages) {
@@ -7366,10 +7380,10 @@
}
}
- private boolean isCallerSameApp(String packageName) {
+ private boolean isCallerSameApp(String packageName, int uid) {
PackageParser.Package pkg = mPackages.get(packageName);
return pkg != null
- && UserHandle.getAppId(Binder.getCallingUid()) == pkg.applicationInfo.uid;
+ && UserHandle.getAppId(uid) == pkg.applicationInfo.uid;
}
@Override
@@ -12900,7 +12914,7 @@
IActivityManager am = ActivityManager.getService();
if (am != null) {
try {
- am.startService(null, intent, null, -1, null, mContext.getOpPackageName(),
+ am.startService(null, intent, null, -1, null, false, mContext.getOpPackageName(),
UserHandle.USER_SYSTEM);
} catch (RemoteException e) {
}
@@ -23133,6 +23147,21 @@
return resolveIntentInternal(
intent, resolvedType, flags, userId, true /*includeInstantApp*/);
}
+
+
+ @Override
+ public void addIsolatedUid(int isolatedUid, int ownerUid) {
+ synchronized (mPackages) {
+ mIsolatedOwners.put(isolatedUid, ownerUid);
+ }
+ }
+
+ @Override
+ public void removeIsolatedUid(int isolatedUid) {
+ synchronized (mPackages) {
+ mIsolatedOwners.delete(isolatedUid);
+ }
+ }
}
@Override
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index aa85574..ae413e5 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -894,9 +894,10 @@
final int lastOrientation = mLastOrientation;
final boolean oldAltOrientation = mAltOrientation;
int rotation = mService.mPolicy.rotationForOrientationLw(lastOrientation, oldRotation);
- final boolean rotateSeamlessly;
+ final boolean rotateSeamlessly = mService.mPolicy.shouldRotateSeamlessly(oldRotation,
+ rotation);
- if (mService.mPolicy.shouldRotateSeamlessly(oldRotation, rotation)) {
+ if (rotateSeamlessly) {
final WindowState seamlessRotated = getWindow((w) -> w.mSeamlesslyRotated);
if (seamlessRotated != null) {
// We can't rotate (seamlessly or not) while waiting for the last seamless rotation
@@ -905,27 +906,6 @@
// window-removal.
return false;
}
-
- final WindowState cantSeamlesslyRotate = getWindow((w) ->
- w.isChildWindow() && w.isVisibleNow()
- && !w.mWinAnimator.mSurfaceController.getTransformToDisplayInverse());
- if (cantSeamlesslyRotate != null) {
- // In what can only be called an unfortunate workaround we require seamlessly
- // rotated child windows to have the TRANSFORM_TO_DISPLAY_INVERSE flag. Due to
- // limitations in the client API, there is no way for the client to set this flag in
- // a race free fashion. If we seamlessly rotate a window which does not have this
- // flag, but then gains it, we will get an incorrect visual result
- // (rotated viewfinder). This means if we want to support seamlessly rotating
- // windows which could gain this flag, we can't rotate windows without it. This
- // limits seamless rotation in N to camera framework users, windows without
- // children, and native code. This is unfortunate but having the camera work is our
- // primary goal.
- rotateSeamlessly = false;
- } else {
- rotateSeamlessly = true;
- }
- } else {
- rotateSeamlessly = false;
}
// TODO: Implement forced rotation changes.
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 826fb45..a7f6db1 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -591,6 +591,17 @@
}
}
+ private int getLayerStack() {
+ return mWin.getDisplayContent().getDisplay().getLayerStack();
+ }
+
+ void updateLayerStackInTransaction() {
+ if (mSurfaceController != null) {
+ mSurfaceController.setLayerStackInTransaction(
+ getLayerStack());
+ }
+ }
+
WindowSurfaceController createSurfaceLocked(int windowType, int ownerUid) {
final WindowState w = mWin;
if (w.restoreSavedSurface()) {
@@ -703,8 +714,7 @@
}
// Start a new transaction and apply position & offset.
- final int layerStack = w.getDisplayContent().getDisplay().getLayerStack();
- mSurfaceController.setPositionAndLayer(mTmpSize.left, mTmpSize.top, layerStack, mAnimLayer);
+ mSurfaceController.setPositionAndLayer(mTmpSize.left, mTmpSize.top, getLayerStack(), mAnimLayer);
mLastHidden = true;
if (WindowManagerService.localLOGV) Slog.v(TAG, "Created surface " + this);
@@ -1435,7 +1445,6 @@
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER);
w.applyDimLayerIfNeeded();
}
-
}
void prepareSurfaceLocked(final boolean recoveringMemory) {
@@ -1926,57 +1935,26 @@
DisplayContent.createRotationMatrix(deltaRotation, x, y, displayWidth, displayHeight,
transform);
- // We have two cases:
- // 1. Windows with NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY:
- // These windows never change buffer size when rotating. Rather the window manager
- // just updates the scaling factors to fit in the new coordinate system,
- // and SurfaceFlinger takes care of updating the buffer contents. So in this case
- // we just need we just need to update the scaling factors and things are seamless
- // already.
- // 2. Other windows:
- // In this case, we need to apply a rotation matrix to the window. For example
- // if we have a portrait window and rotate to landscape, the window is still portrait
- // and now extends off the bottom of the screen (and only halfway across). Essentially we
- // apply a transform to display the current buffer at it's old position
- // (in the new coordinate space). We then freeze layer updates until the resize
- // occurs, at which point we undo, them.
- if (w.isChildWindow() && mSurfaceController.getTransformToDisplayInverse()) {
- frameRect.set(x, y, x + width, y + height);
- transform.mapRect(frameRect);
+ // We just need to apply a rotation matrix to the window. For example
+ // if we have a portrait window and rotate to landscape, the window is still portrait
+ // and now extends off the bottom of the screen (and only halfway across). Essentially we
+ // apply a transform to display the current buffer at it's old position
+ // (in the new coordinate space). We then freeze layer updates until the resize
+ // occurs, at which point we undo, them.
+ mService.markForSeamlessRotation(w, true);
+ transform.getValues(mService.mTmpFloats);
- final Rect parentWindowFrame = w.getParentWindow().mFrame;
- w.mAttrs.x = (int) frameRect.left - parentWindowFrame.left;
- w.mAttrs.y = (int) frameRect.top - parentWindowFrame.top;
- w.mAttrs.width = (int) Math.ceil(frameRect.width());
- w.mAttrs.height = (int) Math.ceil(frameRect.height());
-
- w.setWindowScale(w.mRequestedWidth, w.mRequestedHeight);
-
- w.applyGravityAndUpdateFrame(w.mContainingFrame, w.mDisplayFrame);
- computeShownFrameLocked();
- setSurfaceBoundariesLocked(false);
-
- // The stack bounds will not yet be rotated at this point so setSurfaceBoundaries locked
- // will crop us incorrectly. Overwrite the crop, exposing the full surface. By the next
- // transaction this will be corrected.
- cropRect.set(0, 0, w.mRequestedWidth, w.mRequestedWidth + w.mRequestedHeight);
- mSurfaceController.setCropInTransaction(cropRect, false);
- } else {
- mService.markForSeamlessRotation(w, true);
- transform.getValues(mService.mTmpFloats);
-
- float DsDx = mService.mTmpFloats[Matrix.MSCALE_X];
- float DtDx = mService.mTmpFloats[Matrix.MSKEW_Y];
- float DtDy = mService.mTmpFloats[Matrix.MSKEW_X];
- float DsDy = mService.mTmpFloats[Matrix.MSCALE_Y];
- float nx = mService.mTmpFloats[Matrix.MTRANS_X];
- float ny = mService.mTmpFloats[Matrix.MTRANS_Y];
- mSurfaceController.setPositionInTransaction(nx, ny, false);
- mSurfaceController.setMatrixInTransaction(DsDx * w.mHScale,
- DtDx * w.mVScale,
- DtDy * w.mHScale,
- DsDy * w.mVScale, false);
- }
+ float DsDx = mService.mTmpFloats[Matrix.MSCALE_X];
+ float DtDx = mService.mTmpFloats[Matrix.MSKEW_Y];
+ float DtDy = mService.mTmpFloats[Matrix.MSKEW_X];
+ float DsDy = mService.mTmpFloats[Matrix.MSCALE_Y];
+ float nx = mService.mTmpFloats[Matrix.MTRANS_X];
+ float ny = mService.mTmpFloats[Matrix.MTRANS_Y];
+ mSurfaceController.setPositionInTransaction(nx, ny, false);
+ mSurfaceController.setMatrixInTransaction(DsDx * w.mHScale,
+ DtDx * w.mVScale,
+ DtDy * w.mHScale,
+ DsDy * w.mVScale, false);
}
void enableSurfaceTrace(FileDescriptor fd) {
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index b08bb70..adf4501 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -276,6 +276,12 @@
}
}
+ void setLayerStackInTransaction(int layerStack) {
+ if (mSurfaceControl != null) {
+ mSurfaceControl.setLayerStack(layerStack);
+ }
+ }
+
void setPositionInTransaction(float left, float top, boolean recoveringMemory) {
final boolean surfaceMoved = mSurfaceX != left || mSurfaceY != top;
if (surfaceMoved) {
@@ -357,7 +363,8 @@
return false;
}
- boolean prepareToShowInTransaction(float alpha, int layer, float dsdx, float dtdx, float dsdy,
+ boolean prepareToShowInTransaction(float alpha, int layer,
+ float dsdx, float dtdx, float dsdy,
float dtdy, boolean recoveringMemory) {
if (mSurfaceControl != null) {
try {
@@ -371,7 +378,6 @@
mLastDtdy = dtdy;
mSurfaceControl.setMatrix(
dsdx, dtdx, dsdy, dtdy);
-
} catch (RuntimeException e) {
Slog.w(TAG, "Error updating surface in " + title, e);
if (!recoveringMemory) {
@@ -509,10 +515,6 @@
return mSurfaceControl.getHandle();
}
- boolean getTransformToDisplayInverse() {
- return mSurfaceControl.getTransformToDisplayInverse();
- }
-
void getSurface(Surface outSurface) {
outSurface.copyFrom(mSurfaceControl);
}
diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java
index fab59d6..e3033c9 100644
--- a/services/core/java/com/android/server/wm/WindowToken.java
+++ b/services/core/java/com/android/server/wm/WindowToken.java
@@ -30,6 +30,7 @@
import android.os.Debug;
import android.os.IBinder;
import android.util.Slog;
+import android.view.SurfaceControl;
import java.io.PrintWriter;
@@ -245,6 +246,18 @@
void onDisplayChanged(DisplayContent dc) {
dc.reParentWindowToken(this);
mDisplayContent = dc;
+
+ // TODO(b/36740756): One day this should perhaps be hooked
+ // up with goodToGo, so we don't move a window
+ // to another display before the window behind
+ // it is ready.
+ SurfaceControl.openTransaction();
+ for (int i = mChildren.size() - 1; i >= 0; --i) {
+ final WindowState win = mChildren.get(i);
+ win.mWinAnimator.updateLayerStackInTransaction();
+ }
+ SurfaceControl.closeTransaction();
+
super.onDisplayChanged(dc);
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 7a226a0..bb83633 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1390,6 +1390,13 @@
public static final String KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY =
"boosted_lte_earfcns_string_array";
+ /**
+ * Key identifying if voice call barring notification is required to be shown to the user.
+ * @hide
+ */
+ public static final String KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL =
+ "disable_voice_barring_notification_bool";
+
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -1625,6 +1632,7 @@
null);
sDefaults.putInt(KEY_LTE_EARFCNS_RSRP_BOOST_INT, 0);
sDefaults.putStringArray(KEY_BOOSTED_LTE_EARFCNS_STRING_ARRAY, null);
+ sDefaults.putBoolean(KEY_DISABLE_VOICE_BARRING_NOTIFICATION_BOOL, false);
}
/**
diff --git a/test-runner/src/android/test/mock/MockContext.java b/test-runner/src/android/test/mock/MockContext.java
index da1d998..dca74ff 100644
--- a/test-runner/src/android/test/mock/MockContext.java
+++ b/test-runner/src/android/test/mock/MockContext.java
@@ -526,6 +526,12 @@
}
@Override
+ public ComponentName startForegroundService(Intent service) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** STOPSHIP remove when trial API is turned down */
+ @Override
public ComponentName startServiceInForeground(Intent service,
int id, Notification notification) {
throw new UnsupportedOperationException();
@@ -544,6 +550,12 @@
/** @hide */
@Override
+ public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** @hide STOPSHIP removed when trial API is turned down */
+ @Override
public ComponentName startServiceInForegroundAsUser(Intent service,
int id, Notification notification, UserHandle user) {
throw new UnsupportedOperationException();
diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
index e118889..80e3bad 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
@@ -233,7 +233,8 @@
Map<String, ByteBuffer> bufferForPath) {
FontFamily fontFamily = new FontFamily(family.getLanguage(), family.getVariant());
for (FontConfig.Font font : family.getFonts()) {
- FontFamily_Delegate.addFont(fontFamily.mBuilderPtr, font.getFontName(),
+ String fullPathName = "/system/fonts/" + font.getFontName();
+ FontFamily_Delegate.addFont(fontFamily.mBuilderPtr, fullPathName,
font.getWeight(), font.isItalic());
}
fontFamily.freeze();
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 5c28150..06272c8 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -1853,6 +1853,18 @@
}
@Override
+ public ComponentName startForegroundService(Intent service) {
+ // pass
+ return null;
+ }
+
+ @Override
+ public ComponentName startForegroundServiceAsUser(Intent service, UserHandle user) {
+ // pass
+ return null;
+ }
+
+ @Override
public ComponentName startServiceInForeground(Intent service,
int id, Notification notification) {
// pass