Merge "Set Secure User ID from app level."
diff --git a/api/current.txt b/api/current.txt
index ee0ec9b..c659e21 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1099,7 +1099,8 @@
field public static final int showAsAction = 16843481; // 0x10102d9
field public static final int showDefault = 16843258; // 0x10101fa
field public static final int showDividers = 16843561; // 0x1010329
- field public static final int showOnLockScreen = 16843721; // 0x10103c9
+ field public static final int showForAllUsers = 16844018; // 0x10104f2
+ field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9
field public static final int showSilent = 16843259; // 0x10101fb
field public static final int showText = 16843949; // 0x10104ad
field public static final deprecated int showWeekNumber = 16843582; // 0x101033e
@@ -3635,12 +3636,15 @@
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
field public int affiliatedTaskId;
+ field public android.content.ComponentName baseActivity;
field public android.content.Intent baseIntent;
field public java.lang.CharSequence description;
field public int id;
+ field public int numActivities;
field public android.content.ComponentName origActivity;
field public int persistentId;
field public android.app.ActivityManager.TaskDescription taskDescription;
+ field public android.content.ComponentName topActivity;
}
public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
@@ -16295,7 +16299,7 @@
public final class MediaSync {
ctor public MediaSync();
- method public void configureAudioTrack(android.media.AudioTrack, int);
+ method public void configureAudioTrack(android.media.AudioTrack);
method public void configureSurface(android.view.Surface);
method public final android.view.Surface createInputSurface();
method public boolean getTimestamp(android.media.MediaTimestamp);
@@ -28469,6 +28473,7 @@
public static abstract class KeyStoreKeyProperties.Origin {
field public static final int GENERATED = 1; // 0x1
field public static final int IMPORTED = 2; // 0x2
+ field public static final int UNKNOWN = 4; // 0x4
}
public static abstract class KeyStoreKeyProperties.OriginEnum implements java.lang.annotation.Annotation {
@@ -29960,7 +29965,6 @@
}
public final class Call {
- method public void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -29977,12 +29981,13 @@
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
+ method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
- method public void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
+ method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -29995,6 +30000,19 @@
field public static final int STATE_RINGING = 2; // 0x2
}
+ public static abstract class Call.Callback {
+ ctor public Call.Callback();
+ method public void onCallDestroyed(android.telecom.Call);
+ method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
+ method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
+ method public void onParentChanged(android.telecom.Call, android.telecom.Call);
+ method public void onPostDialWait(android.telecom.Call, java.lang.String);
+ method public void onStateChanged(android.telecom.Call, int);
+ method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
+ }
+
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -30033,19 +30051,6 @@
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
- public static abstract class Call.Listener {
- ctor public Call.Listener();
- method public void onCallDestroyed(android.telecom.Call);
- method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
- method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
- method public void onParentChanged(android.telecom.Call, android.telecom.Call);
- method public void onPostDialWait(android.telecom.Call, java.lang.String);
- method public void onStateChanged(android.telecom.Call, int);
- method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
- }
-
public class CallProperties {
ctor public CallProperties();
field public static final int CONFERENCE = 1; // 0x1
@@ -30294,6 +30299,7 @@
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
+ method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -30303,12 +30309,12 @@
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
- method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
+ method public deprecated void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
}
- public static abstract class InCallService.VideoCall.Listener {
- ctor public InCallService.VideoCall.Listener();
+ public static abstract class InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);
@@ -30318,6 +30324,10 @@
method public abstract void onVideoQualityChanged(int);
}
+ public static abstract deprecated class InCallService.VideoCall.Listener extends android.telecom.InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Listener();
+ }
+
public final class Phone {
method public final void addListener(android.telecom.Phone.Listener);
method public final boolean canAddCall();
diff --git a/api/system-current.txt b/api/system-current.txt
index f476203..2c15005 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1176,7 +1176,8 @@
field public static final int showAsAction = 16843481; // 0x10102d9
field public static final int showDefault = 16843258; // 0x10101fa
field public static final int showDividers = 16843561; // 0x1010329
- field public static final int showOnLockScreen = 16843721; // 0x10103c9
+ field public static final int showForAllUsers = 16844018; // 0x10104f2
+ field public static final deprecated int showOnLockScreen = 16843721; // 0x10103c9
field public static final int showSilent = 16843259; // 0x10101fb
field public static final int showText = 16843949; // 0x10104ad
field public static final deprecated int showWeekNumber = 16843582; // 0x101033e
@@ -3724,12 +3725,15 @@
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
field public int affiliatedTaskId;
+ field public android.content.ComponentName baseActivity;
field public android.content.Intent baseIntent;
field public java.lang.CharSequence description;
field public int id;
+ field public int numActivities;
field public android.content.ComponentName origActivity;
field public int persistentId;
field public android.app.ActivityManager.TaskDescription taskDescription;
+ field public android.content.ComponentName topActivity;
}
public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
@@ -17510,7 +17514,7 @@
public final class MediaSync {
ctor public MediaSync();
- method public void configureAudioTrack(android.media.AudioTrack, int);
+ method public void configureAudioTrack(android.media.AudioTrack);
method public void configureSurface(android.view.Surface);
method public final android.view.Surface createInputSurface();
method public boolean getTimestamp(android.media.MediaTimestamp);
@@ -30472,6 +30476,7 @@
public static abstract class KeyStoreKeyProperties.Origin {
field public static final int GENERATED = 1; // 0x1
field public static final int IMPORTED = 2; // 0x2
+ field public static final int UNKNOWN = 4; // 0x4
}
public static abstract class KeyStoreKeyProperties.OriginEnum implements java.lang.annotation.Annotation {
@@ -32060,7 +32065,7 @@
}
public final class Call {
- method public void addListener(android.telecom.Call.Listener);
+ method public deprecated void addListener(android.telecom.Call.Listener);
method public void answer(int);
method public void conference(android.telecom.Call);
method public void disconnect();
@@ -32077,12 +32082,14 @@
method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
method public void playDtmfTone(char);
method public void postDialContinue(boolean);
+ method public void registerCallback(android.telecom.Call.Callback);
method public void reject(boolean, java.lang.String);
- method public void removeListener(android.telecom.Call.Listener);
+ method public deprecated void removeListener(android.telecom.Call.Listener);
method public void splitFromConference();
method public void stopDtmfTone();
method public void swapConference();
method public void unhold();
+ method public void unregisterCallback(android.telecom.Call.Callback);
field public static final java.lang.String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
field public static final int STATE_ACTIVE = 4; // 0x4
field public static final int STATE_CONNECTING = 9; // 0x9
@@ -32095,6 +32102,19 @@
field public static final int STATE_RINGING = 2; // 0x2
}
+ public static abstract class Call.Callback {
+ ctor public Call.Callback();
+ method public void onCallDestroyed(android.telecom.Call);
+ method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
+ method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+ method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
+ method public void onParentChanged(android.telecom.Call, android.telecom.Call);
+ method public void onPostDialWait(android.telecom.Call, java.lang.String);
+ method public void onStateChanged(android.telecom.Call, int);
+ method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
+ }
+
public static class Call.Details {
method public static boolean can(int, int);
method public boolean can(int);
@@ -32133,17 +32153,8 @@
field public static final int CAPABILITY_WIFI = 65536; // 0x10000
}
- public static abstract class Call.Listener {
+ public static abstract deprecated class Call.Listener extends android.telecom.Call.Callback {
ctor public Call.Listener();
- method public void onCallDestroyed(android.telecom.Call);
- method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
- method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
- method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
- method public void onParentChanged(android.telecom.Call, android.telecom.Call);
- method public void onPostDialWait(android.telecom.Call, java.lang.String);
- method public void onStateChanged(android.telecom.Call, int);
- method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
}
public class CallProperties {
@@ -32397,6 +32408,7 @@
public static abstract class InCallService.VideoCall {
ctor public InCallService.VideoCall();
+ method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
method public abstract void requestCallDataUsage();
method public abstract void requestCameraCapabilities();
method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
@@ -32406,12 +32418,12 @@
method public abstract void setDisplaySurface(android.view.Surface);
method public abstract void setPauseImage(java.lang.String);
method public abstract void setPreviewSurface(android.view.Surface);
- method public abstract void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
+ method public deprecated void setVideoCallListener(android.telecom.InCallService.VideoCall.Listener);
method public abstract void setZoom(float);
}
- public static abstract class InCallService.VideoCall.Listener {
- ctor public InCallService.VideoCall.Listener();
+ public static abstract class InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Callback();
method public abstract void onCallDataUsageChanged(long);
method public abstract void onCallSessionEvent(int);
method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities);
@@ -32421,6 +32433,10 @@
method public abstract void onVideoQualityChanged(int);
}
+ public static abstract deprecated class InCallService.VideoCall.Listener extends android.telecom.InCallService.VideoCall.Callback {
+ ctor public InCallService.VideoCall.Listener();
+ }
+
public final class Phone {
method public final void addListener(android.telecom.Phone.Listener);
method public final boolean canAddCall();
@@ -32694,6 +32710,10 @@
field public static final java.lang.String BOOL_CARRIER_VOLTE_TTY_SUPPORTED = "bool_carrier_volte_tty_supported";
field public static final java.lang.String BOOL_SHOW_APN_SETTING_CDMA = "bool_show_apn_setting_cdma";
field public static final java.lang.String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+ field public static final java.lang.String SHORT_VVM_PORT_NUMBER = "string_vvm_port_number";
+ field public static final java.lang.String STRING_VVM_DESTINATION_NUMBER = "string_vvm_destination_number";
+ field public static final java.lang.String STRING_VVM_TYPE = "string_vvm_type";
+ field public static final java.lang.String VVM_TYPE_OMTP = "vvm_type_omtp";
}
public final class CellIdentityCdma implements android.os.Parcelable {
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 51ececc..134ecdd 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -862,6 +862,23 @@
*/
public int affiliatedTaskColor;
+ /**
+ * The component launched as the first activity in the task.
+ * This can be considered the "application" of this task.
+ */
+ public ComponentName baseActivity;
+
+ /**
+ * The activity component at the top of the history stack of the task.
+ * This is what the user is currently doing.
+ */
+ public ComponentName topActivity;
+
+ /**
+ * Number of activities in this task.
+ */
+ public int numActivities;
+
public RecentTaskInfo() {
}
@@ -895,6 +912,9 @@
dest.writeLong(lastActiveTime);
dest.writeInt(affiliatedTaskId);
dest.writeInt(affiliatedTaskColor);
+ ComponentName.writeToParcel(baseActivity, dest);
+ ComponentName.writeToParcel(topActivity, dest);
+ dest.writeInt(numActivities);
}
public void readFromParcel(Parcel source) {
@@ -911,6 +931,9 @@
lastActiveTime = source.readLong();
affiliatedTaskId = source.readInt();
affiliatedTaskColor = source.readInt();
+ baseActivity = ComponentName.readFromParcel(source);
+ topActivity = ComponentName.readFromParcel(source);
+ numActivities = source.readInt();
}
public static final Creator<RecentTaskInfo> CREATOR
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index 8d82aa2..16f6b1e 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -223,11 +223,12 @@
*/
public static final int FLAG_HARDWARE_ACCELERATED = 0x0200;
/**
- * Value for {@link #flags}: true when the application can be displayed over the lockscreen
- * and consequently over all users' windows.
+ * Value for {@link #flags}: true when the application can be displayed for all users
+ * regardless of if the user of the application is the current user. Set from the
+ * {@link android.R.attr#showForAllUsers} attribute.
* @hide
*/
- public static final int FLAG_SHOW_ON_LOCK_SCREEN = 0x0400;
+ public static final int FLAG_SHOW_FOR_ALL_USERS = 0x0400;
/**
* Bit in {@link #flags} corresponding to an immersive activity
* that wishes not to be interrupted by notifications.
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index caf069f..e2701ee 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -339,8 +339,8 @@
* (e.g., HTTP rather than HTTPS; WebSockets rather than WebSockets Secure; XMPP, IMAP, STMP
* without STARTTLS or TLS). If {@code false}, the app declares that it does not intend to use
* cleartext network traffic, in which case platform components (e.g., HTTP stacks,
- * {@code WebView}, {@code MediaPlayer}) will refuse app's requests to use cleartext traffic.
- * Third-party libraries are encouraged to honor this flag as well.
+ * {@code WebView}, {@code DownloadManager}, {@code MediaPlayer}) will refuse app's requests to
+ * use cleartext traffic. Third-party libraries are encouraged to honor this flag as well.
*/
public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 1<<27;
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 40f4e8f..fed9261 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3099,8 +3099,9 @@
a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS;
}
- if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false)) {
- a.info.flags |= ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN;
+ if (sa.getBoolean(R.styleable.AndroidManifestActivity_showOnLockScreen, false)
+ || sa.getBoolean(R.styleable.AndroidManifestActivity_showForAllUsers, false)) {
+ a.info.flags |= ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
}
if (sa.getBoolean(R.styleable.AndroidManifestActivity_immersive, false)) {
diff --git a/core/java/android/security/NetworkSecurityPolicy.java b/core/java/android/security/NetworkSecurityPolicy.java
index 0b3bf453..70cd388 100644
--- a/core/java/android/security/NetworkSecurityPolicy.java
+++ b/core/java/android/security/NetworkSecurityPolicy.java
@@ -46,9 +46,9 @@
* without TLS or STARTTLS) is permitted for this process.
*
* <p>When cleartext network traffic is not permitted, the platform's components (e.g. HTTP and
- * FTP stacks, {@link android.webkit.WebView}, {@link android.media.MediaPlayer}) will refuse
- * this process's requests to use cleartext traffic. Third-party libraries are strongly
- * encouraged to honor this setting as well.
+ * FTP stacks, {@link android.webkit.WebView}, {@link android.app.DownloadManager},
+ * {@link android.media.MediaPlayer}) will refuse this process's requests to use cleartext
+ * traffic. Third-party libraries are strongly encouraged to honor this setting as well.
*
* <p>This flag is honored on a best effort basis because it's impossible to prevent all
* cleartext traffic from Android applications given the level of access provided to them. For
diff --git a/core/java/android/security/keymaster/KeymasterArgument.java b/core/java/android/security/keymaster/KeymasterArgument.java
index 9a1c894..9adde35 100644
--- a/core/java/android/security/keymaster/KeymasterArgument.java
+++ b/core/java/android/security/keymaster/KeymasterArgument.java
@@ -42,6 +42,7 @@
case KeymasterDefs.KM_INT_REP:
return new KeymasterIntArgument(tag, in);
case KeymasterDefs.KM_LONG:
+ case KeymasterDefs.KM_LONG_REP:
return new KeymasterLongArgument(tag, in);
case KeymasterDefs.KM_DATE:
return new KeymasterDateArgument(tag, in);
diff --git a/core/java/android/security/keymaster/KeymasterArguments.java b/core/java/android/security/keymaster/KeymasterArguments.java
index 8ed288c..82f65c7 100644
--- a/core/java/android/security/keymaster/KeymasterArguments.java
+++ b/core/java/android/security/keymaster/KeymasterArguments.java
@@ -63,6 +63,12 @@
}
}
+ public void addLongs(int tag, long... values) {
+ for (long value : values) {
+ addLong(tag, value);
+ }
+ }
+
public void addBoolean(int tag) {
mArguments.add(new KeymasterBooleanArgument(tag));
}
@@ -111,8 +117,13 @@
}
public long getLong(int tag, long defaultValue) {
- if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_LONG) {
- throw new IllegalArgumentException("Tag is not a long type: " + tag);
+ switch (KeymasterDefs.getTagType(tag)) {
+ case KeymasterDefs.KM_LONG:
+ break; // Accepted type
+ case KeymasterDefs.KM_LONG_REP:
+ throw new IllegalArgumentException("Repeatable tags must use getLongs: " + tag);
+ default:
+ throw new IllegalArgumentException("Tag is not a long type: " + tag);
}
KeymasterArgument arg = getArgumentByTag(tag);
if (arg == null) {
@@ -175,6 +186,19 @@
return values;
}
+ public List<Long> getLongs(int tag) {
+ if (KeymasterDefs.getTagType(tag) != KeymasterDefs.KM_LONG_REP) {
+ throw new IllegalArgumentException("Tag is not a repeating long: " + tag);
+ }
+ List<Long> values = new ArrayList<Long>();
+ for (KeymasterArgument arg : mArguments) {
+ if (arg.tag == tag) {
+ values.add(((KeymasterLongArgument) arg).value);
+ }
+ }
+ return values;
+ }
+
public int size() {
return mArguments.size();
}
diff --git a/core/java/android/security/keymaster/KeymasterLongArgument.java b/core/java/android/security/keymaster/KeymasterLongArgument.java
index 9d2be09..eb17b7e 100644
--- a/core/java/android/security/keymaster/KeymasterLongArgument.java
+++ b/core/java/android/security/keymaster/KeymasterLongArgument.java
@@ -28,6 +28,7 @@
super(tag);
switch (KeymasterDefs.getTagType(tag)) {
case KeymasterDefs.KM_LONG:
+ case KeymasterDefs.KM_LONG_REP:
break; // OK.
default:
throw new IllegalArgumentException("Bad long tag " + tag);
diff --git a/core/java/android/service/gatekeeper/IGateKeeperService.aidl b/core/java/android/service/gatekeeper/IGateKeeperService.aidl
index 2f3e296..9edd04d 100644
--- a/core/java/android/service/gatekeeper/IGateKeeperService.aidl
+++ b/core/java/android/service/gatekeeper/IGateKeeperService.aidl
@@ -53,13 +53,20 @@
* Verifies an enrolled handle against a provided, plaintext blob.
* @param uid The Android user ID associated to this enrollment
* @param challenge a challenge to authenticate agaisnt the device credential. If successful
- * authentication occurs, this value will be written to the returned
+ * authentication occurs, this value will be written to the returned
* authentication attestation.
* @param enrolledPasswordHandle The handle against which the provided password will be
* verified.
* @param The plaintext blob to verify against enrolledPassword.
* @return an opaque attestation of authentication on success, or null.
*/
- byte[] verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
+ byte[] verifyChallenge(int uid, long challenge, in byte[] enrolledPasswordHandle,
in byte[] providedPassword);
+
+ /**
+ * Retrieves the secure identifier for the user with the provided Android ID,
+ * or 0 if none is found.
+ * @param uid the Android user id
+ */
+ long getSecureUserId(int uid);
}
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java
index 866137c..354c15f 100644
--- a/core/java/android/text/TextDirectionHeuristics.java
+++ b/core/java/android/text/TextDirectionHeuristics.java
@@ -81,29 +81,47 @@
private static final int STATE_FALSE = 1;
private static final int STATE_UNKNOWN = 2;
- private static int isRtlText(int directionality) {
- switch (directionality) {
+ /* Returns STATE_TRUE for strong RTL characters, STATE_FALSE for strong LTR characters, and
+ * STATE_UNKNOWN for everything else.
+ */
+ private static int isRtlCodePoint(int codePoint) {
+ switch (Character.getDirectionality(codePoint)) {
case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
return STATE_FALSE;
case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
return STATE_TRUE;
- default:
- return STATE_UNKNOWN;
- }
- }
+ case Character.DIRECTIONALITY_UNDEFINED:
+ // Unassigned characters still have bidi direction, defined at:
+ // http://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedBidiClass.txt
- private static int isRtlTextOrFormat(int directionality) {
- switch (directionality) {
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
- return STATE_FALSE;
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
- return STATE_TRUE;
+ if ((0x0590 <= codePoint && codePoint <= 0x08FF) ||
+ (0xFB1D <= codePoint && codePoint <= 0xFDCF) ||
+ (0xFDF0 <= codePoint && codePoint <= 0xFDFF) ||
+ (0xFE70 <= codePoint && codePoint <= 0xFEFF) ||
+ (0x10800 <= codePoint && codePoint <= 0x10FFF) ||
+ (0x1E800 <= codePoint && codePoint <= 0x1EFFF)) {
+ // Unassigned RTL character
+ return STATE_TRUE;
+ } else if (
+ // Potentially-unassigned Default_Ignorable. Ranges are from unassigned
+ // characters that have Unicode property Other_Default_Ignorable_Code_Point
+ // plus some enlargening to cover bidi isolates and simplify checks.
+ (0x2065 <= codePoint && codePoint <= 0x2069) ||
+ (0xFFF0 <= codePoint && codePoint <= 0xFFF8) ||
+ (0xE0000 <= codePoint && codePoint <= 0xE0FFF) ||
+ // Non-character
+ (0xFDD0 <= codePoint && codePoint <= 0xFDEF) ||
+ ((codePoint & 0xFFFE) == 0xFFFE) ||
+ // Currency symbol
+ (0x20A0 <= codePoint && codePoint <= 0x20CF) ||
+ // Unpaired surrogate
+ (0xD800 <= codePoint && codePoint <= 0xDFFF)) {
+ return STATE_UNKNOWN;
+ } else {
+ // Unassigned LTR character
+ return STATE_FALSE;
+ }
default:
return STATE_UNKNOWN;
}
@@ -181,14 +199,26 @@
/**
* Algorithm that uses the first strong directional character to determine the paragraph
- * direction. This is the standard Unicode Bidirectional algorithm.
+ * direction. This is the standard Unicode Bidirectional Algorithm (steps P2 and P3), with the
+ * exception that if no strong character is found, UNKNOWN is returned.
*/
private static class FirstStrong implements TextDirectionAlgorithm {
@Override
public int checkRtl(CharSequence cs, int start, int count) {
int result = STATE_UNKNOWN;
- for (int i = start, e = start + count; i < e && result == STATE_UNKNOWN; ++i) {
- result = isRtlTextOrFormat(Character.getDirectionality(cs.charAt(i)));
+ int openIsolateCount = 0;
+ for (int cp, i = start, end = start + count;
+ i < end && result == STATE_UNKNOWN;
+ i += Character.charCount(cp)) {
+ cp = Character.codePointAt(cs, i);
+ if (0x2066 <= cp && cp <= 0x2068) { // Opening isolates
+ openIsolateCount += 1;
+ } else if (cp == 0x2069) { // POP DIRECTIONAL ISOLATE (PDI)
+ if (openIsolateCount > 0) openIsolateCount -= 1;
+ } else if (openIsolateCount == 0) {
+ // Only consider the characters outside isolate pairs
+ result = isRtlCodePoint(cp);
+ }
}
return result;
}
@@ -200,9 +230,10 @@
}
/**
- * Algorithm that uses the presence of any strong directional non-format
- * character (e.g. excludes LRE, LRO, RLE, RLO) to determine the
- * direction of text.
+ * Algorithm that uses the presence of any strong directional character of the type indicated
+ * in the constructor parameter to determine the direction of text.
+ *
+ * Characters inside isolate pairs are skipped.
*/
private static class AnyStrong implements TextDirectionAlgorithm {
private final boolean mLookForRtl;
@@ -210,22 +241,31 @@
@Override
public int checkRtl(CharSequence cs, int start, int count) {
boolean haveUnlookedFor = false;
- for (int i = start, e = start + count; i < e; ++i) {
- switch (isRtlText(Character.getDirectionality(cs.charAt(i)))) {
- case STATE_TRUE:
- if (mLookForRtl) {
- return STATE_TRUE;
- }
- haveUnlookedFor = true;
- break;
- case STATE_FALSE:
- if (!mLookForRtl) {
- return STATE_FALSE;
- }
- haveUnlookedFor = true;
- break;
- default:
- break;
+ int openIsolateCount = 0;
+ for (int cp, i = start, end = start + count; i < end; i += Character.charCount(cp)) {
+ cp = Character.codePointAt(cs, i);
+ if (0x2066 <= cp && cp <= 0x2068) { // Opening isolates
+ openIsolateCount += 1;
+ } else if (cp == 0x2069) { // POP DIRECTIONAL ISOLATE (PDI)
+ if (openIsolateCount > 0) openIsolateCount -= 1;
+ } else if (openIsolateCount == 0) {
+ // Only consider the characters outside isolate pairs
+ switch (isRtlCodePoint(cp)) {
+ case STATE_TRUE:
+ if (mLookForRtl) {
+ return STATE_TRUE;
+ }
+ haveUnlookedFor = true;
+ break;
+ case STATE_FALSE:
+ if (!mLookForRtl) {
+ return STATE_FALSE;
+ }
+ haveUnlookedFor = true;
+ break;
+ default:
+ break;
+ }
}
}
if (haveUnlookedFor) {
diff --git a/core/java/android/text/method/BaseKeyListener.java b/core/java/android/text/method/BaseKeyListener.java
index 07c1ec3..fe7571f 100644
--- a/core/java/android/text/method/BaseKeyListener.java
+++ b/core/java/android/text/method/BaseKeyListener.java
@@ -97,7 +97,7 @@
// Delete a character.
final int start = Selection.getSelectionEnd(content);
final int end;
- if (isForwardDelete || event.isShiftPressed() || isShiftActive) {
+ if (isForwardDelete) {
end = TextUtils.getOffsetAfter(content, start);
} else {
end = TextUtils.getOffsetBefore(content, start);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 25fa349..fa40e5f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -18173,7 +18173,8 @@
// flag not set, setMeasuredDimension() was not invoked, we raise
// an exception to warn the developer
if ((mPrivateFlags & PFLAG_MEASURED_DIMENSION_SET) != PFLAG_MEASURED_DIMENSION_SET) {
- throw new IllegalStateException("onMeasure() did not set the"
+ throw new IllegalStateException("View with id " + getId() + ": "
+ + getClass().getName() + "#onMeasure() did not set the"
+ " measured dimension by calling"
+ " setMeasuredDimension()");
}
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index d6f9f78..ff74c60 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -703,9 +703,9 @@
// fallthrough
case KeyEvent.KEYCODE_DPAD_RIGHT:
increment = isLayoutRtl() ? -increment : increment;
- int progress = getProgress() + increment;
- if (progress > 0 && progress < getMax()) {
- setProgress(progress, true);
+
+ // Let progress bar handle clamping values.
+ if (setProgress(getProgress() + increment, true)) {
onKeyChange();
return true;
}
@@ -729,10 +729,10 @@
if (isEnabled()) {
final int progress = getProgress();
if (progress > 0) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
}
if (progress < getMax()) {
- info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
+ info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
}
}
}
@@ -743,29 +743,26 @@
if (super.performAccessibilityActionInternal(action, arguments)) {
return true;
}
+
if (!isEnabled()) {
return false;
}
- final int progress = getProgress();
- final int increment = Math.max(1, Math.round((float) getMax() / 5));
- switch (action) {
- case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
- if (progress <= 0) {
- return false;
- }
- setProgress(progress - increment, true);
+
+ if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD
+ || action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
+ int increment = Math.max(1, Math.round((float) getMax() / 5));
+ if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
+ increment = -increment;
+ }
+
+ // Let progress bar handle clamping values.
+ if (setProgress(getProgress() + increment, true)) {
onKeyChange();
return true;
}
- case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
- if (progress >= getMax()) {
- return false;
- }
- setProgress(progress + increment, true);
- onKeyChange();
- return true;
- }
+ return false;
}
+
return false;
}
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 24e9cbe..b59ae17 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -43,6 +43,7 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
+import android.util.MathUtils;
import android.util.Pools.SynchronizedPool;
import android.view.Gravity;
import android.view.RemotableViewMethod;
@@ -1341,23 +1342,22 @@
}
@android.view.RemotableViewMethod
- synchronized void setProgress(int progress, boolean fromUser) {
+ synchronized boolean setProgress(int progress, boolean fromUser) {
if (mIndeterminate) {
- return;
+ // Not applicable.
+ return false;
}
- if (progress < 0) {
- progress = 0;
+ progress = MathUtils.constrain(progress, 0, mMax);
+
+ if (progress == mProgress) {
+ // No change from current.
+ return false;
}
- if (progress > mMax) {
- progress = mMax;
- }
-
- if (progress != mProgress) {
- mProgress = progress;
- refreshProgress(R.id.progress, mProgress, fromUser);
- }
+ mProgress = progress;
+ refreshProgress(R.id.progress, mProgress, fromUser);
+ return true;
}
/**
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 0ac366d..12d7e60 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -501,9 +501,16 @@
<attr name="excludeFromRecents" format="boolean" />
<!-- Specify that an Activity should be shown over the lock screen and,
- in a multiuser environment, across all users' windows -->
+ in a multiuser environment, across all users' windows.
+ @deprecated use {@link android.R.attr#showForAllUsers} instead. -->
<attr name="showOnLockScreen" format="boolean" />
+ <!-- Specify that an Activity should be shown even if the current/foreground user
+ is different from the user of the Activity. This will also force the
+ <code>android.view.LayoutParams.FLAG_SHOW_WHEN_LOCKED</code> flag
+ to be set for all windows of this activity -->
+ <attr name="showForAllUsers" format="boolean" />
+
<!-- Specify the authorities under which this content provider can be
found. Multiple authorities may be supplied by separating them
with a semicolon. Authority names should use a Java-style naming
@@ -1761,6 +1768,7 @@
<attr name="alwaysRetainTaskState" />
<attr name="stateNotNeeded" />
<attr name="excludeFromRecents" />
+ <!-- @deprecated use {@link android.R.attr#showForAllUsers} instead. -->
<attr name="showOnLockScreen" />
<!-- Specify whether the activity is enabled or not (that is, can be instantiated by the system).
It can also be specified for an application as a whole, in which case a value of "false"
@@ -1789,6 +1797,7 @@
<attr name="resumeWhilePausing" />
<attr name="resizeableActivity" />
<attr name="lockTaskMode" />
+ <attr name="showForAllUsers" />
</declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 77b56ea..208afb7d 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2669,4 +2669,6 @@
<public type="attr" name="leftIndents" />
<public type="attr" name="rightIndents" />
+
+ <public type="attr" name="showForAllUsers" />
</resources>
diff --git a/docs/html/guide/topics/manifest/application-element.jd b/docs/html/guide/topics/manifest/application-element.jd
index b5af9c3..d6ad656 100644
--- a/docs/html/guide/topics/manifest/application-element.jd
+++ b/docs/html/guide/topics/manifest/application-element.jd
@@ -32,6 +32,7 @@
android:<a href="#testOnly">testOnly</a>=["true" | "false"]
android:<a href="#theme">theme</a>="<i>resource or theme</i>"
android:<a href="#uioptions">uiOptions</a>=["none" | "splitActionBarWhenNarrow"]
+ android:<a href="#usesCleartextTraffic">usesCleartextTraffic</a>=["true" | "false"]
android:<a href="#vmSafeMode">vmSafeMode</a>=["true" | "false"] >
. . .
</application></pre></dd>
@@ -446,6 +447,32 @@
<p>This attribute was added in API level 14.</p>
</dd>
+<dt><a name="usesCleartextTraffic"></a>{@code android:usesCleartextTraffic}</dt>
+<dd>Indicates whether the app intends to use cleartext network traffic, such as cleartext HTTP.
+The default value is {@code "true"}.
+
+<p>When the attribute is set to {@code "false"}, platform components (for example, HTTP and FTP
+stacks, {@link android.webkit.WebView}, {@link android.app.DownloadManager},
+{@link android.media.MediaPlayer}) will refuse the app's requests to use cleartext traffic.
+Third-party libraries are strongly encouraged to honor this setting as well. The key reason for
+avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against
+tampering: a network attacker can eavesdrop on transmitted data and also modify it without being
+detected.
+
+<p>This flag is honored on a best effort basis because it's impossible to prevent all cleartext
+traffic from Android applications given the level of access provided to them. For example, there's
+no expectation that the {@link java.net.Socket} API will honor this flag because it cannot
+determine whether its traffic is in cleartext. However, most network traffic from applications is
+handled by higher-level network stacks/components which can honor this flag by either reading it
+from {@link android.content.pm.ApplicationInfo#flags ApplicationInfo.flags} or
+{@link android.security.NetworkSecurityPolicy#isCleartextTrafficPermitted() NetworkSecurityPolicy.isCleartextTrafficPermitted()}.
+
+<p>During app development, StrictMode can be used to identify any cleartext traffic from the app: see
+{@link android.os.StrictMode.VmPolicy.Builder#detectCleartextNetwork() StrictMode.VmPolicy.Builder.detectCleartextNetwork()}.
+
+<p>This attribute was added in API level 23.</p>
+</dd>
+
<dt><a name="vmSafeMode"></a>{@code android:vmSafeMode}</dt>
<dd>Indicates whether the app would like the virtual machine (VM) to operate
in safe mode. The default value is {@code "false"}.
diff --git a/keystore/java/android/security/KeyStoreKeyProperties.java b/keystore/java/android/security/KeyStoreKeyProperties.java
index a0faf88..206103f 100644
--- a/keystore/java/android/security/KeyStoreKeyProperties.java
+++ b/keystore/java/android/security/KeyStoreKeyProperties.java
@@ -217,7 +217,7 @@
}
@Retention(RetentionPolicy.SOURCE)
- @IntDef({Origin.GENERATED, Origin.IMPORTED})
+ @IntDef({Origin.GENERATED, Origin.IMPORTED, Origin.UNKNOWN})
public @interface OriginEnum {}
/**
@@ -235,8 +235,6 @@
/**
* Origin of the key is unknown. This can occur only for keys backed by an old TEE
* implementation which does not record origin information.
- *
- * @hide
*/
public static final int UNKNOWN = 1 << 2;
diff --git a/media/java/android/media/MediaSync.java b/media/java/android/media/MediaSync.java
index 7350bd4..9446c0c 100644
--- a/media/java/android/media/MediaSync.java
+++ b/media/java/android/media/MediaSync.java
@@ -43,9 +43,9 @@
* // MediaCodec videoDecoder = ...;
* videoDecoder.configure(format, inputSurface, ...);
* ...
- * sync.configureAudioTrack(audioTrack, nativeSampleRateInHz);
+ * sync.configureAudioTrack(audioTrack);
* sync.setCallback(new MediaSync.Callback() {
- * \@Override
+ * {@literal @Override}
* public void onReturnAudioBuffer(MediaSync sync, ByteBuffer audioBuffer, int bufferIndex) {
* ...
* }
@@ -151,8 +151,6 @@
private Handler mCallbackHandler = null;
private MediaSync.Callback mCallback = null;
- private int mNativeSampleRateInHz = 0;
-
private Thread mAudioThread = null;
// Created on mAudioThread when mAudioThread is started. When used on user thread, they should
// be guarded by checking mAudioThread.
@@ -247,20 +245,17 @@
* Configures the audio track for MediaSync.
*
* @param audioTrack Specify an AudioTrack through which to render the audio data.
- * @throws IllegalArgumentException if the audioTrack has been released, or is invalid,
- * or nativeSampleRateInHz is invalid.
+ * @throws IllegalArgumentException if the audioTrack has been released, or is invalid.
* @throws IllegalStateException if not in the Initialized state, or another audio track
* has already been configured.
*/
- public void configureAudioTrack(AudioTrack audioTrack, int nativeSampleRateInHz) {
- if (audioTrack != null && nativeSampleRateInHz <= 0) {
- final String msg = "Native sample rate " + nativeSampleRateInHz + " is invalid";
- throw new IllegalArgumentException(msg);
- }
+ public void configureAudioTrack(AudioTrack audioTrack) {
+ // AudioTrack has sanity check for configured sample rate.
+ int nativeSampleRateInHz = (audioTrack == null ? 0 : audioTrack.getSampleRate());
+
native_configureAudioTrack(audioTrack, nativeSampleRateInHz);
mAudioTrack = audioTrack;
- mNativeSampleRateInHz = nativeSampleRateInHz;
- if (mAudioThread == null) {
+ if (audioTrack != null && mAudioThread == null) {
createAudioThread();
}
}
@@ -349,8 +344,9 @@
int status = AudioTrack.SUCCESS;
if (mAudioTrack != null) {
- int playbackSampleRate = (int)(rate * mNativeSampleRateInHz + 0.5);
- rate = playbackSampleRate / (float)mNativeSampleRateInHz;
+ int nativeSampleRateInHz = mAudioTrack.getSampleRate();
+ int playbackSampleRate = (int)(rate * nativeSampleRateInHz + 0.5);
+ rate = playbackSampleRate / (float)nativeSampleRateInHz;
try {
if (rate == 0.0) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f25808b..b658932 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7851,6 +7851,27 @@
rti.lastActiveTime = tr.lastActiveTime;
rti.affiliatedTaskId = tr.mAffiliatedTaskId;
rti.affiliatedTaskColor = tr.mAffiliatedTaskColor;
+ rti.numActivities = 0;
+
+ ActivityRecord base = null;
+ ActivityRecord top = null;
+ ActivityRecord tmp;
+
+ for (int i = tr.mActivities.size() - 1; i >= 0; --i) {
+ tmp = tr.mActivities.get(i);
+ if (tmp.finishing) {
+ continue;
+ }
+ base = tmp;
+ if (top == null || (top.state == ActivityState.INITIALIZING)) {
+ top = base;
+ }
+ rti.numActivities++;
+ }
+
+ rti.baseActivity = (base != null) ? base.intent.getComponent() : null;
+ rti.topActivity = (top != null) ? top.intent.getComponent() : null;
+
return rti;
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 6210d60..5b1543e 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -16,7 +16,7 @@
package com.android.server.am;
-import static android.content.pm.ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN;
+import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
import static com.android.server.am.ActivityManagerDebugConfig.*;
@@ -375,7 +375,7 @@
}
boolean okToShowLocked(ActivityRecord r) {
- return isCurrentProfileLocked(r.userId) || (r.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) != 0;
+ return isCurrentProfileLocked(r.userId) || (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0;
}
final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
@@ -624,7 +624,7 @@
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord r = activities.get(activityNdx);
- if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) == 0) {
+ if (notCurrentUserTask && (r.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0) {
return null;
}
if (!r.finishing && r.intent.getComponent().equals(cls) && r.userId == userId) {
@@ -2024,7 +2024,7 @@
// Now put task at top.
int taskNdx = mTaskHistory.size();
final boolean notShownWhenLocked =
- (newActivity != null && (newActivity.info.flags & FLAG_SHOW_ON_LOCK_SCREEN) == 0)
+ (newActivity != null && (newActivity.info.flags & FLAG_SHOW_FOR_ALL_USERS) == 0)
|| (newActivity == null && task.topRunningActivityLocked(null) == null);
if (!isCurrentProfileLocked(task.userId) && notShownWhenLocked) {
// Put non-current user tasks below current user tasks.
@@ -2074,7 +2074,7 @@
r.putInHistory();
mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0,
r.userId, r.info.configChanges, task.voiceSession != null,
r.mLaunchTaskBehind);
if (VALIDATE_TOKENS) {
@@ -2138,7 +2138,7 @@
}
mWindowManager.addAppToken(task.mActivities.indexOf(r),
r.appToken, r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0, r.userId,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId,
r.info.configChanges, task.voiceSession != null, r.mLaunchTaskBehind);
boolean doShow = true;
if (newTask) {
@@ -2190,7 +2190,7 @@
// because there is nothing for it to animate on top of.
mWindowManager.addAppToken(task.mActivities.indexOf(r), r.appToken,
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0, r.userId,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId,
r.info.configChanges, task.voiceSession != null, r.mLaunchTaskBehind);
ActivityOptions.abort(options);
options = null;
@@ -4061,6 +4061,7 @@
}
ActivityRecord r = null;
ActivityRecord top = null;
+ ActivityRecord tmp;
int numActivities = 0;
int numRunning = 0;
final ArrayList<ActivityRecord> activities = task.mActivities;
@@ -4068,7 +4069,11 @@
continue;
}
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
- r = activities.get(activityNdx);
+ tmp = activities.get(activityNdx);
+ if (tmp.finishing) {
+ continue;
+ }
+ r = tmp;
// Initialize state for next task if needed.
if (top == null || (top.state == ActivityState.INITIALIZING)) {
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 6908483..58bdc28 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2826,7 +2826,7 @@
final ActivityRecord r = activities.get(activityNdx);
mWindowManager.addAppToken(0, r.appToken, task.taskId, stack.mStackId,
r.info.screenOrientation, r.fullscreen,
- (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0,
+ (r.info.flags & ActivityInfo.FLAG_SHOW_FOR_ALL_USERS) != 0,
r.userId, r.info.configChanges, task.voiceSession != null,
r.mLaunchTaskBehind);
}
diff --git a/services/core/java/com/android/server/display/DisplayDevice.java b/services/core/java/com/android/server/display/DisplayDevice.java
index e16be71..ee36972 100644
--- a/services/core/java/com/android/server/display/DisplayDevice.java
+++ b/services/core/java/com/android/server/display/DisplayDevice.java
@@ -47,6 +47,10 @@
// within a transaction from performTraversalInTransactionLocked.
private Surface mCurrentSurface;
+ // DEBUG STATE: Last device info which was written to the log, or null if none.
+ // Do not use for any other purpose.
+ DisplayDeviceInfo mDebugLastLoggedDeviceInfo;
+
public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken, String uniqueId) {
mDisplayAdapter = displayAdapter;
mDisplayToken = displayToken;
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index d1e73f0..ebf6e4e 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -104,6 +104,16 @@
public static final int TOUCH_EXTERNAL = 2;
/**
+ * Diff result: The {@link #state} fields differ.
+ */
+ public static final int DIFF_STATE = 1 << 0;
+
+ /**
+ * Diff result: Other fields differ.
+ */
+ public static final int DIFF_OTHER = 1 << 1;
+
+ /**
* Gets the name of the display device, which may be derived from EDID or
* other sources. The name may be localized and displayed to the user.
*/
@@ -238,26 +248,39 @@
}
public boolean equals(DisplayDeviceInfo other) {
- return other != null
- && Objects.equal(name, other.name)
- && Objects.equal(uniqueId, other.uniqueId)
- && width == other.width
- && height == other.height
- && refreshRate == other.refreshRate
- && Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
- && densityDpi == other.densityDpi
- && xDpi == other.xDpi
- && yDpi == other.yDpi
- && appVsyncOffsetNanos == other.appVsyncOffsetNanos
- && presentationDeadlineNanos == other.presentationDeadlineNanos
- && flags == other.flags
- && touch == other.touch
- && rotation == other.rotation
- && type == other.type
- && Objects.equal(address, other.address)
- && state == other.state
- && ownerUid == other.ownerUid
- && Objects.equal(ownerPackageName, other.ownerPackageName);
+ return other != null && diff(other) == 0;
+ }
+
+ /**
+ * Computes the difference between display device infos.
+ * Assumes other is not null.
+ */
+ public int diff(DisplayDeviceInfo other) {
+ int diff = 0;
+ if (state != other.state) {
+ diff |= DIFF_STATE;
+ }
+ if (!Objects.equal(name, other.name)
+ || !Objects.equal(uniqueId, other.uniqueId)
+ || width != other.width
+ || height != other.height
+ || refreshRate != other.refreshRate
+ || !Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
+ || densityDpi != other.densityDpi
+ || xDpi != other.xDpi
+ || yDpi != other.yDpi
+ || appVsyncOffsetNanos != other.appVsyncOffsetNanos
+ || presentationDeadlineNanos != other.presentationDeadlineNanos
+ || flags != other.flags
+ || touch != other.touch
+ || rotation != other.rotation
+ || type != other.type
+ || !Objects.equal(address, other.address)
+ || ownerUid != other.ownerUid
+ || !Objects.equal(ownerPackageName, other.ownerPackageName)) {
+ diff |= DIFF_OTHER;
+ }
+ return diff;
}
@Override
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 9ea0444..1e87433 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -668,13 +668,14 @@
}
private void handleDisplayDeviceAddedLocked(DisplayDevice device) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (mDisplayDevices.contains(device)) {
- Slog.w(TAG, "Attempted to add already added display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to add already added display device: " + info);
return;
}
- Slog.i(TAG, "Display device added: " + device.getDisplayDeviceInfoLocked());
+ Slog.i(TAG, "Display device added: " + info);
+ device.mDebugLastLoggedDeviceInfo = info;
mDisplayDevices.add(device);
addLogicalDisplayLocked(device);
@@ -687,13 +688,20 @@
private void handleDisplayDeviceChanged(DisplayDevice device) {
synchronized (mSyncRoot) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (!mDisplayDevices.contains(device)) {
- Slog.w(TAG, "Attempted to change non-existent display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to change non-existent display device: " + info);
return;
}
- Slog.i(TAG, "Display device changed: " + device.getDisplayDeviceInfoLocked());
+ int diff = device.mDebugLastLoggedDeviceInfo.diff(info);
+ if (diff == DisplayDeviceInfo.DIFF_STATE) {
+ Slog.i(TAG, "Display device changed state: \"" + info.name
+ + "\", " + Display.stateToString(info.state));
+ } else if (diff != 0) {
+ Slog.i(TAG, "Display device changed: " + info);
+ }
+ device.mDebugLastLoggedDeviceInfo = info;
device.applyPendingDisplayDeviceInfoChangesLocked();
if (updateLogicalDisplaysLocked()) {
@@ -708,13 +716,14 @@
}
}
private void handleDisplayDeviceRemovedLocked(DisplayDevice device) {
+ DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
if (!mDisplayDevices.remove(device)) {
- Slog.w(TAG, "Attempted to remove non-existent display device: "
- + device.getDisplayDeviceInfoLocked());
+ Slog.w(TAG, "Attempted to remove non-existent display device: " + info);
return;
}
- Slog.i(TAG, "Display device removed: " + device.getDisplayDeviceInfoLocked());
+ Slog.i(TAG, "Display device removed: " + info);
+ device.mDebugLastLoggedDeviceInfo = info;
updateLogicalDisplaysLocked();
scheduleTraversalLocked(false);
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 4ac2b48..94f8dee 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -913,6 +913,12 @@
}
}
+ @ServiceThreadOnly
+ boolean isConnected(int portId) {
+ assertRunOnServiceThread();
+ return mService.isConnected(portId);
+ }
+
private void notifyArcStatusToAudioService(boolean enabled) {
// Note that we don't set any name to ARC.
mService.getAudioManager().setWiredDeviceConnectionState(
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 49a96d8..2cbc1b9 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -780,6 +780,12 @@
return false;
}
+ @ServiceThreadOnly
+ boolean isConnected(int portId) {
+ assertRunOnServiceThread();
+ return mCecController.isConnected(portId);
+ }
+
void runOnServiceThread(Runnable runnable) {
mHandler.post(runnable);
}
diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
index a944a27..5f2d651 100644
--- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
+++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
@@ -156,10 +156,13 @@
int index = -1;
while ((index = removed.nextSetBit(index + 1)) != -1) {
if (index == Constants.ADDR_AUDIO_SYSTEM) {
- ++mAvrStatusCount;
- Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount);
- if (mAvrStatusCount < AVR_COUNT_MAX) {
- continue;
+ HdmiDeviceInfo avr = tv().getAvrDeviceInfo();
+ if (avr != null && tv().isConnected(avr.getPortId())) {
+ ++mAvrStatusCount;
+ Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount);
+ if (mAvrStatusCount < AVR_COUNT_MAX) {
+ continue;
+ }
}
}
Slog.v(TAG, "Remove device by hot-plug detection:" + index);
diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java
index 7c41abbc..a279e0f 100644
--- a/services/core/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/core/java/com/android/server/location/GpsLocationProvider.java
@@ -197,6 +197,8 @@
private static final int REMOVE_LISTENER = 9;
private static final int INJECT_NTP_TIME_FINISHED = 10;
private static final int DOWNLOAD_XTRA_DATA_FINISHED = 11;
+ private static final int SUBSCRIPTION_OR_SIM_CHANGED = 12;
+ private static final int INITIALIZE_HANDLER = 13;
// Request setid
private static final int AGPS_RIL_REQUEST_SETID_IMSI = 1;
@@ -338,8 +340,12 @@
// True if gps should be disabled (used to support battery saver mode in settings).
private boolean mDisableGps = false;
- // properties loaded from PROPERTIES_FILE
+ /**
+ * Properties loaded from PROPERTIES_FILE.
+ * It must be accessed only inside {@link #mHandler}.
+ */
private Properties mProperties;
+
private String mSuplServerHost;
private int mSuplServerPort = TCP_MIN_PORT;
private String mC2KServerHost;
@@ -462,7 +468,7 @@
new OnSubscriptionsChangedListener() {
@Override
public void onSubscriptionsChanged() {
- subscriptionOrSimChanged(mContext);
+ sendMessage(SUBSCRIPTION_OR_SIM_CHANGED, 0, null);
}
};
@@ -627,53 +633,22 @@
mBatteryStats = IBatteryStats.Stub.asInterface(ServiceManager.getService(
BatteryStats.SERVICE_NAME));
- // Load GPS configuration.
+ // Construct internal handler
+ mHandler = new ProviderHandler(looper);
+
+ // Load GPS configuration and register listeners in the background:
+ // some operations, such as opening files and registering broadcast receivers, can take a
+ // relative long time, so the ctor() is kept to create objects needed by this instance,
+ // while IO initialization and registration is delegated to our internal handler
+ // this approach is just fine because events are posted to our handler anyway
mProperties = new Properties();
- reloadGpsProperties(mContext, mProperties);
+ sendMessage(INITIALIZE_HANDLER, 0, null);
// Create a GPS net-initiated handler.
mNIHandler = new GpsNetInitiatedHandler(context,
mNetInitiatedListener,
mSuplEsEnabled);
- // TODO: When this object "finishes" we should unregister by invoking
- // SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
- // This is not strictly necessary because it will be unregistered if the
- // notification fails but it is good form.
-
- // Register for SubscriptionInfo list changes which is guaranteed
- // to invoke onSubscriptionsChanged the first time.
- SubscriptionManager.from(mContext)
- .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
-
- // construct handler, listen for events
- mHandler = new ProviderHandler(looper);
- listenForBroadcasts();
-
- // also listen for PASSIVE_PROVIDER updates
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- LocationManager locManager =
- (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
- final long minTime = 0;
- final float minDistance = 0;
- final boolean oneShot = false;
- LocationRequest request = LocationRequest.createFromDeprecatedProvider(
- LocationManager.PASSIVE_PROVIDER,
- minTime,
- minDistance,
- oneShot);
- // Don't keep track of this request since it's done on behalf of other clients
- // (which are kept track of separately).
- request.setHideFromAppOps(true);
- locManager.requestLocationUpdates(
- request,
- new NetworkLocationListener(),
- mHandler.getLooper());
- }
- });
-
mListenerHelper = new GpsStatusListenerHelper(mHandler) {
@Override
protected boolean isAvailableInPlatform() {
@@ -731,33 +706,6 @@
};
}
- private void listenForBroadcasts() {
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION);
- intentFilter.addDataScheme("sms");
- intentFilter.addDataAuthority("localhost","7275");
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
-
- intentFilter = new IntentFilter();
- intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION);
- try {
- intentFilter.addDataType("application/vnd.omaloc-supl-init");
- } catch (IntentFilter.MalformedMimeTypeException e) {
- Log.w(TAG, "Malformed SUPL init mime type");
- }
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
-
- intentFilter = new IntentFilter();
- intentFilter.addAction(ALARM_WAKEUP);
- intentFilter.addAction(ALARM_TIMEOUT);
- intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE);
- intentFilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
- intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
- intentFilter.addAction(Intent.ACTION_SCREEN_ON);
- intentFilter.addAction(SIM_STATE_CHANGED);
- mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, mHandler);
- }
-
/**
* Returns the name of this provider.
*/
@@ -2012,13 +1960,85 @@
case UPDATE_LOCATION:
handleUpdateLocation((Location)msg.obj);
break;
+ case SUBSCRIPTION_OR_SIM_CHANGED:
+ subscriptionOrSimChanged(mContext);
+ break;
+ case INITIALIZE_HANDLER:
+ initialize();
+ break;
}
if (msg.arg2 == 1) {
// wakelock was taken for this message, release it
mWakeLock.release();
}
}
- };
+
+ /**
+ * This method is bound to {@link #GpsLocationProvider(Context, ILocationManager, Looper)}.
+ * It is in charge of loading properties and registering for events that will be posted to
+ * this handler.
+ */
+ private void initialize() {
+ // load default GPS configuration
+ // (this configuration might change in the future based on SIM changes)
+ reloadGpsProperties(mContext, mProperties);
+
+ // TODO: When this object "finishes" we should unregister by invoking
+ // SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
+ // This is not strictly necessary because it will be unregistered if the
+ // notification fails but it is good form.
+
+ // Register for SubscriptionInfo list changes which is guaranteed
+ // to invoke onSubscriptionsChanged the first time.
+ SubscriptionManager.from(mContext)
+ .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener);
+
+ // listen for events
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION);
+ intentFilter.addDataScheme("sms");
+ intentFilter.addDataAuthority("localhost","7275");
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ intentFilter = new IntentFilter();
+ intentFilter.addAction(Intents.WAP_PUSH_RECEIVED_ACTION);
+ try {
+ intentFilter.addDataType("application/vnd.omaloc-supl-init");
+ } catch (IntentFilter.MalformedMimeTypeException e) {
+ Log.w(TAG, "Malformed SUPL init mime type");
+ }
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ intentFilter = new IntentFilter();
+ intentFilter.addAction(ALARM_WAKEUP);
+ intentFilter.addAction(ALARM_TIMEOUT);
+ intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE);
+ intentFilter.addAction(PowerManager.ACTION_POWER_SAVE_MODE_CHANGED);
+ intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
+ intentFilter.addAction(Intent.ACTION_SCREEN_ON);
+ intentFilter.addAction(SIM_STATE_CHANGED);
+ mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this);
+
+ // listen for PASSIVE_PROVIDER updates
+ LocationManager locManager =
+ (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
+ long minTime = 0;
+ float minDistance = 0;
+ boolean oneShot = false;
+ LocationRequest request = LocationRequest.createFromDeprecatedProvider(
+ LocationManager.PASSIVE_PROVIDER,
+ minTime,
+ minDistance,
+ oneShot);
+ // Don't keep track of this request since it's done on behalf of other clients
+ // (which are kept track of separately).
+ request.setHideFromAppOps(true);
+ locManager.requestLocationUpdates(
+ request,
+ new NetworkLocationListener(),
+ getLooper());
+ }
+ }
private final class NetworkLocationListener implements LocationListener {
@Override
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index a04f6cb..e914cd4 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -56,7 +56,7 @@
boolean appFullscreen;
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
boolean layoutConfigChanges;
- boolean showWhenLocked;
+ boolean showForAllUsers;
// The input dispatching timeout for this application token in nanoseconds.
long inputDispatchingTimeoutNanos;
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 34120a0..0c3cf65 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -107,9 +107,9 @@
}
}
- boolean showWhenLocked() {
+ boolean showForAllUsers() {
final int tokensCount = mAppTokens.size();
- return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showWhenLocked;
+ return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
}
@Override
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index e845f83..7cdf8b2 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -276,27 +276,26 @@
}
void addTask(Task task, boolean toTop) {
- addTask(task, toTop, task.showWhenLocked());
+ addTask(task, toTop, task.showForAllUsers());
}
/**
* Put a Task in this stack. Used for adding and moving.
* @param task The task to add.
* @param toTop Whether to add it to the top or bottom.
- * @param showWhenLocked Whether to show the task when the device is locked
- * regardless of the current user.
+ * @param showForAllUsers Whether to show the task regardless of the current user.
*/
- void addTask(Task task, boolean toTop, boolean showWhenLocked) {
+ void addTask(Task task, boolean toTop, boolean showForAllUsers) {
int stackNdx;
if (!toTop) {
stackNdx = 0;
} else {
stackNdx = mTasks.size();
- if (!showWhenLocked && !mService.isCurrentProfileLocked(task.mUserId)) {
+ if (!showForAllUsers && !mService.isCurrentProfileLocked(task.mUserId)) {
// Place the task below all current user tasks.
while (--stackNdx >= 0) {
final Task tmpTask = mTasks.get(stackNdx);
- if (!tmpTask.showWhenLocked()
+ if (!tmpTask.showForAllUsers()
|| !mService.isCurrentProfileLocked(tmpTask.mUserId)) {
break;
}
@@ -498,7 +497,7 @@
int top = mTasks.size();
for (int taskNdx = 0; taskNdx < top; ++taskNdx) {
Task task = mTasks.get(taskNdx);
- if (mService.isCurrentProfileLocked(task.mUserId) || task.showWhenLocked()) {
+ if (mService.isCurrentProfileLocked(task.mUserId) || task.showForAllUsers()) {
mTasks.remove(taskNdx);
mTasks.add(task);
--top;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e790fb0..dbcafc8 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -3620,13 +3620,13 @@
EventLog.writeEvent(EventLogTags.WM_TASK_CREATED, taskId, stackId);
Task task = new Task(taskId, stack, userId, this);
mTaskIdToTask.put(taskId, task);
- stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showWhenLocked);
+ stack.addTask(task, !atoken.mLaunchTaskBehind /* toTop */, atoken.showForAllUsers);
return task;
}
@Override
public void addAppToken(int addPos, IApplicationToken token, int taskId, int stackId,
- int requestedOrientation, boolean fullscreen, boolean showWhenLocked, int userId,
+ int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int userId,
int configChanges, boolean voiceInteraction, boolean launchTaskBehind) {
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
"addAppToken()")) {
@@ -3656,7 +3656,7 @@
atoken = new AppWindowToken(this, token, voiceInteraction);
atoken.inputDispatchingTimeoutNanos = inputDispatchingTimeoutNanos;
atoken.appFullscreen = fullscreen;
- atoken.showWhenLocked = showWhenLocked;
+ atoken.showForAllUsers = showForAllUsers;
atoken.requestedOrientation = requestedOrientation;
atoken.layoutConfigChanges = (configChanges &
(ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_ORIENTATION)) != 0;
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index db3268d..4f795a6 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
+import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
@@ -478,6 +479,12 @@
if (mAppToken != null) {
final DisplayContent appDisplay = getDisplayContent();
mNotOnAppsDisplay = displayContent != appDisplay;
+
+ if (mAppToken.showForAllUsers) {
+ // Windows for apps that can show for all users should also show when the
+ // device is locked.
+ mAttrs.flags |= FLAG_SHOW_WHEN_LOCKED;
+ }
}
mWinAnimator = new WindowStateAnimator(this);
@@ -1353,7 +1360,7 @@
win = win.mAttachedWindow;
}
if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
- && win.mAppToken != null && win.mAppToken.showWhenLocked) {
+ && win.mAppToken != null && win.mAppToken.showForAllUsers) {
// Save some cycles by not calling getDisplayInfo unless it is an application
// window intended for all users.
final DisplayContent displayContent = win.getDisplayContent();
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 33a7fe1..f0bc25d 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.annotation.SystemApi;
import android.net.Uri;
import android.os.Bundle;
@@ -514,7 +515,7 @@
}
}
- public static abstract class Listener {
+ public static abstract class Callback {
/**
* Invoked when the state of this {@code Call} has changed. See {@link #getState()}.
*
@@ -598,13 +599,21 @@
public void onConferenceableCallsChanged(Call call, List<Call> conferenceableCalls) {}
}
+ /**
+ * @deprecated Use {@code Call.Callback} instead.
+ * @hide
+ */
+ @Deprecated
+ @SystemApi
+ public static abstract class Listener extends Callback { }
+
private final Phone mPhone;
private final String mTelecomCallId;
private final InCallAdapter mInCallAdapter;
private final List<String> mChildrenIds = new ArrayList<>();
private final List<Call> mChildren = new ArrayList<>();
private final List<Call> mUnmodifiableChildren = Collections.unmodifiableList(mChildren);
- private final List<Listener> mListeners = new CopyOnWriteArrayList<>();
+ private final List<Callback> mCallbacks = new CopyOnWriteArrayList<>();
private final List<Call> mConferenceableCalls = new ArrayList<>();
private final List<Call> mUnmodifiableConferenceableCalls =
Collections.unmodifiableList(mConferenceableCalls);
@@ -699,8 +708,8 @@
* {@code Call} will temporarily pause playing the tones for a pre-defined period of time.
*
* If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this
- * {@code Call} will pause playing the tones and notify listeners via
- * {@link Listener#onPostDialWait(Call, String)}. At this point, the in-call app
+ * {@code Call} will pause playing the tones and notify callbacks via
+ * {@link Callback#onPostDialWait(Call, String)}. At this point, the in-call app
* should display to the user an indication of this state and an affordance to continue
* the postdial sequence. When the user decides to continue the postdial sequence, the in-call
* app should invoke the {@link #postDialContinue(boolean)} method.
@@ -841,25 +850,52 @@
}
/**
+ * Registers a callback to this {@code Call}.
+ *
+ * @param callback A {@code Callback}.
+ */
+ public void registerCallback(Callback callback) {
+ mCallbacks.add(callback);
+ }
+
+ /**
+ * Unregisters a callback from this {@code Call}.
+ *
+ * @param callback A {@code Callback}.
+ */
+ public void unregisterCallback(Callback callback) {
+ if (callback != null) {
+ mCallbacks.remove(callback);
+ }
+ }
+
+ /**
* Adds a listener to this {@code Call}.
*
* @param listener A {@code Listener}.
+ * @deprecated Use {@link #registerCallback} instead.
+ * @hide
*/
+ @Deprecated
+ @SystemApi
public void addListener(Listener listener) {
- mListeners.add(listener);
+ registerCallback(listener);
}
/**
* Removes a listener from this {@code Call}.
*
* @param listener A {@code Listener}.
+ * @deprecated Use {@link #unregisterCallback} instead.
+ * @hide
*/
+ @Deprecated
+ @SystemApi
public void removeListener(Listener listener) {
- if (listener != null) {
- mListeners.remove(listener);
- }
+ unregisterCallback(listener);
}
+
/** {@hide} */
Call(Phone phone, String telecomCallId, InCallAdapter inCallAdapter) {
mPhone = phone;
@@ -991,56 +1027,56 @@
}
private void fireStateChanged(int newState) {
- for (Listener listener : mListeners) {
- listener.onStateChanged(this, newState);
+ for (Callback callback : mCallbacks) {
+ callback.onStateChanged(this, newState);
}
}
private void fireParentChanged(Call newParent) {
- for (Listener listener : mListeners) {
- listener.onParentChanged(this, newParent);
+ for (Callback callback : mCallbacks) {
+ callback.onParentChanged(this, newParent);
}
}
private void fireChildrenChanged(List<Call> children) {
- for (Listener listener : mListeners) {
- listener.onChildrenChanged(this, children);
+ for (Callback callback : mCallbacks) {
+ callback.onChildrenChanged(this, children);
}
}
private void fireDetailsChanged(Details details) {
- for (Listener listener : mListeners) {
- listener.onDetailsChanged(this, details);
+ for (Callback callback : mCallbacks) {
+ callback.onDetailsChanged(this, details);
}
}
private void fireCannedTextResponsesLoaded(List<String> cannedTextResponses) {
- for (Listener listener : mListeners) {
- listener.onCannedTextResponsesLoaded(this, cannedTextResponses);
+ for (Callback callback : mCallbacks) {
+ callback.onCannedTextResponsesLoaded(this, cannedTextResponses);
}
}
private void fireVideoCallChanged(InCallService.VideoCall videoCall) {
- for (Listener listener : mListeners) {
- listener.onVideoCallChanged(this, videoCall);
+ for (Callback callback : mCallbacks) {
+ callback.onVideoCallChanged(this, videoCall);
}
}
private void firePostDialWait(String remainingPostDialSequence) {
- for (Listener listener : mListeners) {
- listener.onPostDialWait(this, remainingPostDialSequence);
+ for (Callback callback : mCallbacks) {
+ callback.onPostDialWait(this, remainingPostDialSequence);
}
}
private void fireCallDestroyed() {
- for (Listener listener : mListeners) {
- listener.onCallDestroyed(this);
+ for (Callback callback : mCallbacks) {
+ callback.onCallDestroyed(this);
}
}
private void fireConferenceableCallsChanged() {
- for (Listener listener : mListeners) {
- listener.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
+ for (Callback callback : mCallbacks) {
+ callback.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls);
}
}
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index a17474a..4229db8 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -357,12 +357,19 @@
public static abstract class VideoCall {
/**
- * Sets a listener to invoke callback methods in the InCallUI after performing video
- * telephony actions.
+ * Registers a callback to receive c ommands and state changes for video calls.
*
- * @param videoCallListener The call video client.
+ * @param callback The vdieo call callback.
*/
- public abstract void setVideoCallListener(VideoCall.Listener videoCallListener);
+ public abstract void registerCallback(VideoCall.Callback callback);
+
+ /**
+ * @deprecated Use {@code VideoCall#registerCallback} instead.
+ */
+ @Deprecated
+ public void setVideoCallListener(VideoCall.Listener videoCallListener) {
+ registerCallback(videoCallListener);
+ }
/**
* Sets the camera to be used for video recording in a video call.
@@ -405,7 +412,7 @@
/**
* Issues a request to modify the properties of the current session. The request is sent to
* the remote device where it it handled by
- * {@link VideoCall.Listener#onSessionModifyRequestReceived}.
+ * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* Some examples of session modification requests: upgrade call from audio to video,
* downgrade call from video to audio, pause video.
*
@@ -417,9 +424,9 @@
* Provides a response to a request to change the current call session video
* properties.
* This is in response to a request the InCall UI has received via
- * {@link VideoCall.Listener#onSessionModifyRequestReceived}.
+ * {@link VideoCall.Callback#onSessionModifyRequestReceived}.
* The response is handled on the remove device by
- * {@link VideoCall.Listener#onSessionModifyResponseReceived}.
+ * {@link VideoCall.Callback#onSessionModifyResponseReceived}.
*
* @param responseProfile The response call video properties.
*/
@@ -428,14 +435,14 @@
/**
* Issues a request to the video provider to retrieve the camera capabilities.
* Camera capabilities are reported back to the caller via
- * {@link VideoCall.Listener#onCameraCapabilitiesChanged(CameraCapabilities)}.
+ * {@link VideoCall.Callback#onCameraCapabilitiesChanged(CameraCapabilities)}.
*/
public abstract void requestCameraCapabilities();
/**
* Issues a request to the video telephony framework to retrieve the cumulative data usage for
* the current call. Data usage is reported back to the caller via
- * {@link VideoCall.Listener#onCallDataUsageChanged}.
+ * {@link VideoCall.Callback#onCallDataUsageChanged}.
*/
public abstract void requestCallDataUsage();
@@ -448,9 +455,9 @@
public abstract void setPauseImage(String uri);
/**
- * Listener class which invokes callbacks after video call actions occur.
+ * Callback class which invokes callbacks after video call actions occur.
*/
- public static abstract class Listener {
+ public static abstract class Callback {
/**
* Called when a session modification request is received from the remote device.
* The remote request is sent via
@@ -527,5 +534,11 @@
*/
public abstract void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities);
}
+
+ /**
+ * @deprecated Use {@code VideoCall.Callback} instead.
+ */
+ @Deprecated
+ public static abstract class Listener extends Callback { }
}
}
diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java
index 0445448..7bef688 100644
--- a/telecomm/java/android/telecom/VideoCallImpl.java
+++ b/telecomm/java/android/telecom/VideoCallImpl.java
@@ -46,7 +46,7 @@
private final IVideoProvider mVideoProvider;
private final VideoCallListenerBinder mBinder;
- private VideoCall.Listener mVideoCallListener;
+ private VideoCall.Callback mCallback;
private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() {
@Override
@@ -109,14 +109,14 @@
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
- if (mVideoCallListener == null) {
+ if (mCallback == null) {
return;
}
SomeArgs args;
switch (msg.what) {
case MSG_RECEIVE_SESSION_MODIFY_REQUEST:
- mVideoCallListener.onSessionModifyRequestReceived((VideoProfile) msg.obj);
+ mCallback.onSessionModifyRequestReceived((VideoProfile) msg.obj);
break;
case MSG_RECEIVE_SESSION_MODIFY_RESPONSE:
args = (SomeArgs) msg.obj;
@@ -125,34 +125,34 @@
VideoProfile requestProfile = (VideoProfile) args.arg2;
VideoProfile responseProfile = (VideoProfile) args.arg3;
- mVideoCallListener.onSessionModifyResponseReceived(
+ mCallback.onSessionModifyResponseReceived(
status, requestProfile, responseProfile);
} finally {
args.recycle();
}
break;
case MSG_HANDLE_CALL_SESSION_EVENT:
- mVideoCallListener.onCallSessionEvent((int) msg.obj);
+ mCallback.onCallSessionEvent((int) msg.obj);
break;
case MSG_CHANGE_PEER_DIMENSIONS:
args = (SomeArgs) msg.obj;
try {
int width = (int) args.arg1;
int height = (int) args.arg2;
- mVideoCallListener.onPeerDimensionsChanged(width, height);
+ mCallback.onPeerDimensionsChanged(width, height);
} finally {
args.recycle();
}
break;
case MSG_CHANGE_CALL_DATA_USAGE:
- mVideoCallListener.onCallDataUsageChanged((long) msg.obj);
+ mCallback.onCallDataUsageChanged((long) msg.obj);
break;
case MSG_CHANGE_CAMERA_CAPABILITIES:
- mVideoCallListener.onCameraCapabilitiesChanged(
+ mCallback.onCameraCapabilitiesChanged(
(CameraCapabilities) msg.obj);
break;
case MSG_CHANGE_VIDEO_QUALITY:
- mVideoCallListener.onVideoQualityChanged(msg.arg1);
+ mCallback.onVideoQualityChanged(msg.arg1);
break;
default:
break;
@@ -170,8 +170,8 @@
}
/** {@inheritDoc} */
- public void setVideoCallListener(VideoCall.Listener videoCallListener) {
- mVideoCallListener = videoCallListener;
+ public void registerCallback(VideoCall.Callback callback) {
+ mCallback = callback;
}
/** {@inheritDoc} */
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cdf77b4..b1fb3a6 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -78,6 +78,42 @@
*/
public static final String INT_VOLTE_REPLACEMENT_RAT = "int_volte_replacement_rat";
+ /* The following 3 fields are related to carrier visual voicemail. */
+
+ /**
+ * The carrier number MO sms messages are sent to.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String STRING_VVM_DESTINATION_NUMBER = "string_vvm_destination_number";
+
+ /**
+ * The port through which the MO sms messages are sent through.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String SHORT_VVM_PORT_NUMBER = "string_vvm_port_number";
+
+ /**
+ * The type of visual voicemail protocol the carrier adheres to (see below).
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String STRING_VVM_TYPE = "string_vvm_type";
+
+ /* Visual voicemail protocols */
+
+ /**
+ * The OMTP protocol.
+ *
+ * @hide
+ */
+ @SystemApi
+ public static final String VVM_TYPE_OMTP = "vvm_type_omtp";
+
private final static String TAG = "CarrierConfigManager";
/** The default value for every variable. */