Merge "Add known uses to hidden API light greylist" into pi-dev
diff --git a/api/current.txt b/api/current.txt
index c2f1bc5..2875e34 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5752,8 +5752,15 @@
field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0
field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1
field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2
- field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
- field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+ field public static final int SUPPRESSED_EFFECT_AMBIENT = 128; // 0x80
+ field public static final int SUPPRESSED_EFFECT_BADGE = 64; // 0x40
+ field public static final int SUPPRESSED_EFFECT_FULL_SCREEN_INTENT = 4; // 0x4
+ field public static final int SUPPRESSED_EFFECT_LIGHTS = 8; // 0x8
+ field public static final int SUPPRESSED_EFFECT_NOTIFICATION_LIST = 256; // 0x100
+ field public static final int SUPPRESSED_EFFECT_PEEK = 16; // 0x10
+ field public static final deprecated int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
+ field public static final deprecated int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+ field public static final int SUPPRESSED_EFFECT_STATUS_BAR = 32; // 0x20
field public final int priorityCallSenders;
field public final int priorityCategories;
field public final int priorityMessageSenders;
@@ -7263,6 +7270,7 @@
method public android.net.Uri mapIntentToUri(android.content.Intent);
method public void pinSlice(android.net.Uri, java.util.List<android.app.slice.SliceSpec>);
method public void unpinSlice(android.net.Uri);
+ field public static final java.lang.String CATEGORY_SLICE = "android.app.slice.category.SLICE";
field public static final java.lang.String SLICE_METADATA_KEY = "android.metadata.SLICE_URI";
}
@@ -40001,8 +40009,8 @@
field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
field public static final int REASON_USER_STOPPED = 6; // 0x6
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
- field public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
- field public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+ field public static final deprecated int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
+ field public static final deprecated int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
}
public static class NotificationListenerService.Ranking {
@@ -42140,11 +42148,9 @@
package android.telephony {
public final class AccessNetworkConstants {
- ctor public AccessNetworkConstants();
}
public static final class AccessNetworkConstants.AccessNetworkType {
- ctor public AccessNetworkConstants.AccessNetworkType();
field public static final int CDMA2000 = 4; // 0x4
field public static final int EUTRAN = 3; // 0x3
field public static final int GERAN = 1; // 0x1
@@ -42154,7 +42160,6 @@
}
public static final class AccessNetworkConstants.EutranBand {
- ctor public AccessNetworkConstants.EutranBand();
field public static final int BAND_1 = 1; // 0x1
field public static final int BAND_10 = 10; // 0xa
field public static final int BAND_11 = 11; // 0xb
@@ -42206,7 +42211,6 @@
}
public static final class AccessNetworkConstants.GeranBand {
- ctor public AccessNetworkConstants.GeranBand();
field public static final int BAND_450 = 3; // 0x3
field public static final int BAND_480 = 4; // 0x4
field public static final int BAND_710 = 5; // 0x5
@@ -42224,7 +42228,6 @@
}
public static final class AccessNetworkConstants.UtranBand {
- ctor public AccessNetworkConstants.UtranBand();
field public static final int BAND_1 = 1; // 0x1
field public static final int BAND_10 = 10; // 0xa
field public static final int BAND_11 = 11; // 0xb
@@ -42665,7 +42668,8 @@
}
public class NetworkScan {
- method public void stop() throws android.os.RemoteException;
+ method public deprecated void stop() throws android.os.RemoteException;
+ method public void stopScan();
field public static final int ERROR_INTERRUPTED = 10002; // 0x2712
field public static final int ERROR_INVALID_SCAN = 2; // 0x2
field public static final int ERROR_INVALID_SCANID = 10001; // 0x2711
@@ -43130,7 +43134,8 @@
method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
method public boolean isWorldPhone();
method public void listen(android.telephony.PhoneStateListener, int);
- method public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, android.telephony.TelephonyScanManager.NetworkScanCallback);
+ method public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
+ method public deprecated android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, android.telephony.TelephonyScanManager.NetworkScanCallback);
method public void sendDialerSpecialCode(java.lang.String);
method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
method public void sendUssdRequest(java.lang.String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler);
@@ -53391,6 +53396,9 @@
public final class Magnifier {
ctor public Magnifier(android.view.View);
method public void dismiss();
+ method public int getHeight();
+ method public int getWidth();
+ method public float getZoom();
method public void show(float, float);
method public void update();
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 048acbd..f676425d 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4995,7 +4995,6 @@
package android.telephony {
public static final class AccessNetworkConstants.TransportType {
- ctor public AccessNetworkConstants.TransportType();
field public static final int WLAN = 2; // 0x2
field public static final int WWAN = 1; // 0x1
}
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index c78255f..cab6744 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -27,6 +27,7 @@
import android.os.SystemClock;
import android.service.voice.IVoiceInteractionSession;
import android.util.SparseIntArray;
+import android.view.RemoteAnimationAdapter;
import com.android.internal.app.IVoiceInteractor;
@@ -264,6 +265,17 @@
public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi);
/**
+ * Sets if the given pid is currently running a remote animation, which is taken a signal for
+ * determining oom adjustment and scheduling behavior.
+ *
+ * @param pid The pid we are setting overlay UI for.
+ * @param runningRemoteAnimation True if the process is running a remote animation, false
+ * otherwise.
+ * @see RemoteAnimationAdapter
+ */
+ public abstract void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation);
+
+ /**
* Called after the network policy rules are updated by
* {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid} and
* {@param procStateSeq}.
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index b207d57..46d1264 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -1072,20 +1072,77 @@
* @hide
*/
public static final int SUPPRESSED_EFFECTS_UNSET = -1;
+
/**
* Whether notifications suppressed by DND should not interrupt visually (e.g. with
* notification lights or by turning the screen on) when the screen is off.
+ *
+ * @deprecated use {@link #SUPPRESSED_EFFECT_FULL_SCREEN_INTENT} and
+ * {@link #SUPPRESSED_EFFECT_AMBIENT} and {@link #SUPPRESSED_EFFECT_LIGHTS} individually.
*/
+ @Deprecated
public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1 << 0;
/**
* Whether notifications suppressed by DND should not interrupt visually when the screen
* is on (e.g. by peeking onto the screen).
+ *
+ * @deprecated use {@link #SUPPRESSED_EFFECT_PEEK}.
*/
+ @Deprecated
public static final int SUPPRESSED_EFFECT_SCREEN_ON = 1 << 1;
+ /**
+ * Whether {@link Notification#fullScreenIntent full screen intents} from
+ * notifications intercepted by DND are blocked.
+ */
+ public static final int SUPPRESSED_EFFECT_FULL_SCREEN_INTENT = 1 << 2;
+
+ /**
+ * Whether {@link NotificationChannel#shouldShowLights() notification lights} from
+ * notifications intercepted by DND are blocked.
+ */
+ public static final int SUPPRESSED_EFFECT_LIGHTS = 1 << 3;
+
+ /**
+ * Whether notifications intercepted by DND are prevented from peeking.
+ */
+ public static final int SUPPRESSED_EFFECT_PEEK = 1 << 4;
+
+ /**
+ * Whether notifications intercepted by DND are prevented from appearing in the status bar,
+ * on devices that support status bars.
+ */
+ public static final int SUPPRESSED_EFFECT_STATUS_BAR = 1 << 5;
+
+ /**
+ * Whether {@link NotificationChannel#canShowBadge() badges} from
+ * notifications intercepted by DND are blocked on devices that support badging.
+ */
+ public static final int SUPPRESSED_EFFECT_BADGE = 1 << 6;
+
+ /**
+ * Whether notification intercepted by DND are prevented from appearing on ambient displays
+ * on devices that support ambient display.
+ */
+ public static final int SUPPRESSED_EFFECT_AMBIENT = 1 << 7;
+
+ /**
+ * Whether notification intercepted by DND are prevented from appearing in notification
+ * list views like the notification shade or lockscreen on devices that support those
+ * views.
+ */
+ public static final int SUPPRESSED_EFFECT_NOTIFICATION_LIST = 1 << 8;
+
private static final int[] ALL_SUPPRESSED_EFFECTS = {
SUPPRESSED_EFFECT_SCREEN_OFF,
SUPPRESSED_EFFECT_SCREEN_ON,
+ SUPPRESSED_EFFECT_FULL_SCREEN_INTENT,
+ SUPPRESSED_EFFECT_LIGHTS,
+ SUPPRESSED_EFFECT_PEEK,
+ SUPPRESSED_EFFECT_STATUS_BAR,
+ SUPPRESSED_EFFECT_BADGE,
+ SUPPRESSED_EFFECT_AMBIENT,
+ SUPPRESSED_EFFECT_NOTIFICATION_LIST
};
/**
@@ -1097,6 +1154,12 @@
/**
* Constructs a policy for Do Not Disturb priority mode behavior.
*
+ * <p>
+ * Apps that target API levels below {@link Build.VERSION_CODES#P} cannot
+ * change user-designated values to allow or disallow
+ * {@link Policy#PRIORITY_CATEGORY_ALARMS}, {@link Policy#PRIORITY_CATEGORY_SYSTEM}, and
+ * {@link Policy#PRIORITY_CATEGORY_MEDIA} from bypassing dnd.
+ *
* @param priorityCategories bitmask of categories of notifications that can bypass DND.
* @param priorityCallSenders which callers can bypass DND.
* @param priorityMessageSenders which message senders can bypass DND.
@@ -1109,6 +1172,26 @@
/**
* Constructs a policy for Do Not Disturb priority mode behavior.
*
+ * <p>
+ * Apps that target API levels below {@link Build.VERSION_CODES#P} cannot
+ * change user-designated values to allow or disallow
+ * {@link Policy#PRIORITY_CATEGORY_ALARMS}, {@link Policy#PRIORITY_CATEGORY_SYSTEM}, and
+ * {@link Policy#PRIORITY_CATEGORY_MEDIA} from bypassing dnd.
+ * <p>
+ * Additionally, apps that target API levels below {@link Build.VERSION_CODES#P} can
+ * only modify the {@link #SUPPRESSED_EFFECT_SCREEN_ON} and
+ * {@link #SUPPRESSED_EFFECT_SCREEN_OFF} bits of the suppressed visual effects field.
+ * All other suppressed effects will be ignored and reconstituted from the screen on
+ * and screen off values.
+ * <p>
+ * Apps that target {@link Build.VERSION_CODES#P} or above can set any
+ * suppressed visual effects. However, if any suppressed effects >
+ * {@link #SUPPRESSED_EFFECT_SCREEN_ON} are set, {@link #SUPPRESSED_EFFECT_SCREEN_ON}
+ * and {@link #SUPPRESSED_EFFECT_SCREEN_OFF} will be ignored and reconstituted from
+ * the more specific suppressed visual effect bits. Apps should migrate to targeting
+ * specific effects instead of the deprecated {@link #SUPPRESSED_EFFECT_SCREEN_ON} and
+ * {@link #SUPPRESSED_EFFECT_SCREEN_OFF} effects.
+ *
* @param priorityCategories bitmask of categories of notifications that can bypass DND.
* @param priorityCallSenders which callers can bypass DND.
* @param priorityMessageSenders which message senders can bypass DND.
@@ -1190,6 +1273,30 @@
}
}
+ /**
+ * @hide
+ */
+ public static int getAllSuppressedVisualEffects() {
+ int effects = 0;
+ for (int i = 0; i < ALL_SUPPRESSED_EFFECTS.length; i++) {
+ effects |= ALL_SUPPRESSED_EFFECTS[i];
+ }
+ return effects;
+ }
+
+ /**
+ * @hide
+ */
+ public static boolean areAllVisualEffectsSuppressed(int effects) {
+ for (int i = 0; i < ALL_SUPPRESSED_EFFECTS.length; i++) {
+ final int effect = ALL_SUPPRESSED_EFFECTS[i];
+ if ((effects & effect) == 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
public static String suppressedEffectsToString(int effects) {
if (effects <= 0) return "";
final StringBuilder sb = new StringBuilder();
@@ -1228,9 +1335,26 @@
private static String effectToString(int effect) {
switch (effect) {
- case SUPPRESSED_EFFECT_SCREEN_OFF: return "SUPPRESSED_EFFECT_SCREEN_OFF";
- case SUPPRESSED_EFFECT_SCREEN_ON: return "SUPPRESSED_EFFECT_SCREEN_ON";
- case SUPPRESSED_EFFECTS_UNSET: return "SUPPRESSED_EFFECTS_UNSET";
+ case SUPPRESSED_EFFECT_FULL_SCREEN_INTENT:
+ return "SUPPRESSED_EFFECT_FULL_SCREEN_INTENT";
+ case SUPPRESSED_EFFECT_LIGHTS:
+ return "SUPPRESSED_EFFECT_LIGHTS";
+ case SUPPRESSED_EFFECT_PEEK:
+ return "SUPPRESSED_EFFECT_PEEK";
+ case SUPPRESSED_EFFECT_STATUS_BAR:
+ return "SUPPRESSED_EFFECT_STATUS_BAR";
+ case SUPPRESSED_EFFECT_BADGE:
+ return "SUPPRESSED_EFFECT_BADGE";
+ case SUPPRESSED_EFFECT_AMBIENT:
+ return "SUPPRESSED_EFFECT_AMBIENT";
+ case SUPPRESSED_EFFECT_NOTIFICATION_LIST:
+ return "SUPPRESSED_EFFECT_NOTIFICATION_LIST";
+ case SUPPRESSED_EFFECT_SCREEN_OFF:
+ return "SUPPRESSED_EFFECT_SCREEN_OFF";
+ case SUPPRESSED_EFFECT_SCREEN_ON:
+ return "SUPPRESSED_EFFECT_SCREEN_ON";
+ case SUPPRESSED_EFFECTS_UNSET:
+ return "SUPPRESSED_EFFECTS_UNSET";
default: return "UNKNOWN_" + effect;
}
}
diff --git a/core/java/android/app/slice/SliceManager.java b/core/java/android/app/slice/SliceManager.java
index 9f9ce8d..4f3cd63 100644
--- a/core/java/android/app/slice/SliceManager.java
+++ b/core/java/android/app/slice/SliceManager.java
@@ -18,6 +18,8 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemService;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
@@ -60,6 +62,18 @@
"android.intent.action.REQUEST_SLICE_PERMISSION";
/**
+ * Category used to resolve intents that can be rendered as slices.
+ * <p>
+ * This category should be included on intent filters on providers that extend
+ * {@link SliceProvider}.
+ * @see SliceProvider
+ * @see SliceProvider#onMapIntentToUri(Intent)
+ * @see #mapIntentToUri(Intent)
+ */
+ @SdkConstant(SdkConstantType.INTENT_CATEGORY)
+ public static final String CATEGORY_SLICE = "android.app.slice.category.SLICE";
+
+ /**
* The meta-data key that allows an activity to easily be linked directly to a slice.
* <p>
* An activity can be statically linked to a slice uri by including a meta-data item
@@ -226,6 +240,18 @@
/**
* Turns a slice intent into a slice uri. Expects an explicit intent.
+ * <p>
+ * This goes through a several stage resolution process to determine if any slice
+ * can represent this intent.
+ * - If the intent contains data that {@link ContentResolver#getType} is
+ * {@link SliceProvider#SLICE_TYPE} then the data will be returned.
+ * - If the intent with {@link #CATEGORY_SLICE} added resolves to a provider, then
+ * the provider will be asked to {@link SliceProvider#onMapIntentToUri} and that result
+ * will be returned.
+ * - Lastly, if the intent explicitly points at an activity, and that activity has
+ * meta-data for key {@link #SLICE_METADATA_KEY}, then the Uri specified there will be
+ * returned.
+ * - If no slice is found, then {@code null} is returned.
*
* @param intent The intent associated with a slice.
* @return The Slice Uri provided by the app or null if none exists.
@@ -245,8 +271,12 @@
return intentData;
}
// Otherwise ask the app
+ Intent queryIntent = new Intent(intent);
+ if (!queryIntent.hasCategory(CATEGORY_SLICE)) {
+ queryIntent.addCategory(CATEGORY_SLICE);
+ }
List<ResolveInfo> providers =
- mContext.getPackageManager().queryIntentContentProviders(intent, 0);
+ mContext.getPackageManager().queryIntentContentProviders(queryIntent, 0);
if (providers == null || providers.isEmpty()) {
// There are no providers, see if this activity has a direct link.
ResolveInfo resolve = mContext.getPackageManager().resolveActivity(intent,
diff --git a/core/java/android/app/slice/SliceProvider.java b/core/java/android/app/slice/SliceProvider.java
index 64a5181..df32fb9 100644
--- a/core/java/android/app/slice/SliceProvider.java
+++ b/core/java/android/app/slice/SliceProvider.java
@@ -81,6 +81,7 @@
* android:authorities="com.example.mypkg">
* <intent-filter>
* <action android:name="com.example.mypkg.intent.action.MY_SLICE_INTENT" />
+ * <category android:name="android.app.slice.category.SLICE" />
* </intent-filter>
* </provider>}
* </pre>
@@ -253,8 +254,13 @@
* In that case, this method can be called and is expected to return a non-null Uri representing
* a slice. Otherwise this will throw {@link UnsupportedOperationException}.
*
+ * Any intent filter added to a slice provider should also contain
+ * {@link SliceManager#CATEGORY_SLICE}, because otherwise it will not be detected by
+ * {@link SliceManager#mapIntentToUri(Intent)}.
+ *
* @return Uri representing the slice associated with the provided intent.
- * @see {@link Slice}
+ * @see Slice
+ * @see SliceManager#mapIntentToUri(Intent)
*/
public @NonNull Uri onMapIntentToUri(Intent intent) {
throw new UnsupportedOperationException(
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index eebd22a..ea10ae7 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -149,13 +149,19 @@
/**
* Whether notification suppressed by DND should not interruption visually when the screen is
* off.
+ *
+ * @deprecated Use the more specific visual effects in {@link NotificationManager.Policy}.
*/
+ @Deprecated
public static final int SUPPRESSED_EFFECT_SCREEN_OFF =
NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
/**
* Whether notification suppressed by DND should not interruption visually when the screen is
* on.
+ *
+ * @deprecated Use the more specific visual effects in {@link NotificationManager.Policy}.
*/
+ @Deprecated
public static final int SUPPRESSED_EFFECT_SCREEN_ON =
NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
@@ -1453,7 +1459,8 @@
/**
* Returns the type(s) of visual effects that should be suppressed for this notification.
- * See {@link #SUPPRESSED_EFFECT_SCREEN_OFF}, {@link #SUPPRESSED_EFFECT_SCREEN_ON}.
+ * See {@link NotificationManager.Policy}, e.g.
+ * {@link NotificationManager.Policy#SUPPRESSED_EFFECT_LIGHTS}.
*/
public int getSuppressedVisualEffects() {
return mSuppressedVisualEffects;
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index b61919e..740a387 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -92,10 +92,12 @@
private static final boolean DEFAULT_ALLOW_REMINDERS = false;
private static final boolean DEFAULT_ALLOW_EVENTS = false;
private static final boolean DEFAULT_ALLOW_REPEAT_CALLERS = false;
- private static final boolean DEFAULT_ALLOW_SCREEN_OFF = true;
- private static final boolean DEFAULT_ALLOW_SCREEN_ON = true;
+ private static final boolean DEFAULT_ALLOW_SCREEN_OFF = false;
+ private static final boolean DEFAULT_ALLOW_SCREEN_ON = false;
+ private static final int DEFAULT_SUPPRESSED_VISUAL_EFFECTS =
+ Policy.getAllSuppressedVisualEffects();
- public static final int XML_VERSION = 4;
+ public static final int XML_VERSION = 5;
public static final String ZEN_TAG = "zen";
private static final String ZEN_ATT_VERSION = "version";
private static final String ZEN_ATT_USER = "user";
@@ -113,6 +115,8 @@
private static final String ALLOW_ATT_EVENTS = "events";
private static final String ALLOW_ATT_SCREEN_OFF = "visualScreenOff";
private static final String ALLOW_ATT_SCREEN_ON = "visualScreenOn";
+ private static final String DISALLOW_TAG = "disallow";
+ private static final String DISALLOW_ATT_VISUAL_EFFECTS = "visualEffects";
private static final String CONDITION_ATT_ID = "id";
private static final String CONDITION_ATT_SUMMARY = "summary";
@@ -146,6 +150,7 @@
public int allowCallsFrom = DEFAULT_SOURCE;
public int allowMessagesFrom = DEFAULT_SOURCE;
public int user = UserHandle.USER_SYSTEM;
+ public int suppressedVisualEffects = DEFAULT_SUPPRESSED_VISUAL_EFFECTS;
public boolean allowWhenScreenOff = DEFAULT_ALLOW_SCREEN_OFF;
public boolean allowWhenScreenOn = DEFAULT_ALLOW_SCREEN_ON;
public int version;
@@ -180,6 +185,7 @@
allowAlarms = source.readInt() == 1;
allowMedia = source.readInt() == 1;
allowSystem = source.readInt() == 1;
+ suppressedVisualEffects = source.readInt();
}
@Override
@@ -212,6 +218,7 @@
dest.writeInt(allowAlarms ? 1 : 0);
dest.writeInt(allowMedia ? 1 : 0);
dest.writeInt(allowSystem ? 1 : 0);
+ dest.writeInt(suppressedVisualEffects);
}
@Override
@@ -230,6 +237,7 @@
.append(",allowMessagesFrom=").append(sourceToString(allowMessagesFrom))
.append(",allowWhenScreenOff=").append(allowWhenScreenOff)
.append(",allowWhenScreenOn=").append(allowWhenScreenOn)
+ .append(",suppressedVisualEffects=").append(suppressedVisualEffects)
.append(",automaticRules=").append(automaticRules)
.append(",manualRule=").append(manualRule)
.append(']').toString();
@@ -279,6 +287,10 @@
if (allowWhenScreenOn != to.allowWhenScreenOn) {
d.addLine("allowWhenScreenOn", allowWhenScreenOn, to.allowWhenScreenOn);
}
+ if (suppressedVisualEffects != to.suppressedVisualEffects) {
+ d.addLine("suppressedVisualEffects", suppressedVisualEffects,
+ to.suppressedVisualEffects);
+ }
final ArraySet<String> allRules = new ArraySet<>();
addKeys(allRules, automaticRules);
addKeys(allRules, to.automaticRules);
@@ -383,7 +395,8 @@
&& other.allowWhenScreenOn == allowWhenScreenOn
&& other.user == user
&& Objects.equals(other.automaticRules, automaticRules)
- && Objects.equals(other.manualRule, manualRule);
+ && Objects.equals(other.manualRule, manualRule)
+ && other.suppressedVisualEffects == suppressedVisualEffects;
}
@Override
@@ -391,7 +404,8 @@
return Objects.hash(allowAlarms, allowMedia, allowSystem, allowCalls,
allowRepeatCallers, allowMessages,
allowCallsFrom, allowMessagesFrom, allowReminders, allowEvents,
- allowWhenScreenOff, allowWhenScreenOn, user, automaticRules, manualRule);
+ allowWhenScreenOff, allowWhenScreenOn, user, automaticRules, manualRule,
+ suppressedVisualEffects);
}
private static String toDayList(int[] days) {
@@ -474,6 +488,8 @@
rt.allowCallsFrom = DEFAULT_SOURCE;
rt.allowMessagesFrom = DEFAULT_SOURCE;
}
+ // continue to read even though we now have suppressedVisualEffects, in case
+ // we need to revert to users' previous settings
rt.allowWhenScreenOff =
safeBoolean(parser, ALLOW_ATT_SCREEN_OFF, DEFAULT_ALLOW_SCREEN_OFF);
rt.allowWhenScreenOn =
@@ -482,6 +498,9 @@
rt.allowMedia = safeBoolean(parser, ALLOW_ATT_MEDIA,
DEFAULT_ALLOW_MEDIA);
rt.allowSystem = safeBoolean(parser, ALLOW_ATT_SYSTEM, DEFAULT_ALLOW_SYSTEM);
+ } else if (DISALLOW_TAG.equals(tag)) {
+ rt.suppressedVisualEffects = safeInt(parser, DISALLOW_ATT_VISUAL_EFFECTS,
+ DEFAULT_SUPPRESSED_VISUAL_EFFECTS);
} else if (MANUAL_TAG.equals(tag)) {
rt.manualRule = readRuleXml(parser);
} else if (AUTOMATIC_TAG.equals(tag)) {
@@ -517,6 +536,10 @@
out.attribute(null, ALLOW_ATT_SYSTEM, Boolean.toString(allowSystem));
out.endTag(null, ALLOW_TAG);
+ out.startTag(null, DISALLOW_TAG);
+ out.attribute(null, DISALLOW_ATT_VISUAL_EFFECTS, Integer.toString(suppressedVisualEffects));
+ out.endTag(null, DISALLOW_TAG);
+
if (manualRule != null) {
out.startTag(null, MANUAL_TAG);
writeRuleXml(manualRule, out);
@@ -701,13 +724,6 @@
if (allowRepeatCallers) {
priorityCategories |= Policy.PRIORITY_CATEGORY_REPEAT_CALLERS;
}
- int suppressedVisualEffects = 0;
- if (!allowWhenScreenOff) {
- suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
- }
- if (!allowWhenScreenOn) {
- suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_SCREEN_ON;
- }
if (allowAlarms) {
priorityCategories |= Policy.PRIORITY_CATEGORY_ALARMS;
}
@@ -770,10 +786,7 @@
allowMessagesFrom = prioritySendersToSource(policy.priorityMessageSenders,
allowMessagesFrom);
if (policy.suppressedVisualEffects != Policy.SUPPRESSED_EFFECTS_UNSET) {
- allowWhenScreenOff =
- (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_SCREEN_OFF) == 0;
- allowWhenScreenOn =
- (policy.suppressedVisualEffects & Policy.SUPPRESSED_EFFECT_SCREEN_ON) == 0;
+ suppressedVisualEffects = policy.suppressedVisualEffects;
}
}
diff --git a/core/java/android/view/RemoteAnimationAdapter.java b/core/java/android/view/RemoteAnimationAdapter.java
index d597e59..a864e55 100644
--- a/core/java/android/view/RemoteAnimationAdapter.java
+++ b/core/java/android/view/RemoteAnimationAdapter.java
@@ -52,6 +52,9 @@
private final long mDuration;
private final long mStatusBarTransitionDelay;
+ /** @see #getCallingPid */
+ private int mCallingPid;
+
/**
* @param runner The interface that gets notified when we actually need to start the animation.
* @param duration The duration of the animation.
@@ -83,6 +86,20 @@
return mStatusBarTransitionDelay;
}
+ /**
+ * To be called by system_server to keep track which pid is running this animation.
+ */
+ public void setCallingPid(int pid) {
+ mCallingPid = pid;
+ }
+
+ /**
+ * @return The pid of the process running the animation.
+ */
+ public int getCallingPid() {
+ return mCallingPid;
+ }
+
@Override
public int describeContents() {
return 0;
diff --git a/core/java/android/view/RemoteAnimationDefinition.java b/core/java/android/view/RemoteAnimationDefinition.java
index 381f692..8def435 100644
--- a/core/java/android/view/RemoteAnimationDefinition.java
+++ b/core/java/android/view/RemoteAnimationDefinition.java
@@ -70,6 +70,16 @@
mTransitionAnimationMap = in.readSparseArray(null /* loader */);
}
+ /**
+ * To be called by system_server to keep track which pid is running the remote animations inside
+ * this definition.
+ */
+ public void setCallingPid(int pid) {
+ for (int i = mTransitionAnimationMap.size() - 1; i >= 0; i--) {
+ mTransitionAnimationMap.valueAt(i).setCallingPid(pid);
+ }
+ }
+
@Override
public int describeContents() {
return 0;
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 8830c90..d3b1e5c 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -396,7 +396,44 @@
synchronized (mLock) {
checkNotReleasedLocked();
if (mHwuiContext == null) {
- mHwuiContext = new HwuiContext();
+ mHwuiContext = new HwuiContext(false);
+ }
+ return mHwuiContext.lockCanvas(
+ nativeGetWidth(mNativeObject),
+ nativeGetHeight(mNativeObject));
+ }
+ }
+
+ /**
+ * Gets a {@link Canvas} for drawing into this surface that supports wide color gamut.
+ *
+ * After drawing into the provided {@link Canvas}, the caller must
+ * invoke {@link #unlockCanvasAndPost} to post the new contents to the surface.
+ *
+ * Unlike {@link #lockCanvas(Rect)} and {@link #lockHardwareCanvas()},
+ * this will return a hardware-accelerated canvas that supports wide color gamut.
+ * See the <a href="{@docRoot}guide/topics/graphics/hardware-accel.html#unsupported">
+ * unsupported drawing operations</a> for a list of what is and isn't
+ * supported in a hardware-accelerated canvas. It is also required to
+ * fully cover the surface every time {@link #lockHardwareCanvas()} is
+ * called as the buffer is not preserved between frames. Partial updates
+ * are not supported.
+ *
+ * @return A canvas for drawing into the surface.
+ *
+ * @throws IllegalStateException If the canvas cannot be locked.
+ *
+ * @hide
+ */
+ public Canvas lockHardwareWideColorGamutCanvas() {
+ synchronized (mLock) {
+ checkNotReleasedLocked();
+ if (mHwuiContext != null && !mHwuiContext.isWideColorGamut()) {
+ mHwuiContext.destroy();
+ mHwuiContext = null;
+ }
+ if (mHwuiContext == null) {
+ mHwuiContext = new HwuiContext(true);
}
return mHwuiContext.lockCanvas(
nativeGetWidth(mNativeObject),
@@ -829,11 +866,14 @@
private final RenderNode mRenderNode;
private long mHwuiRenderer;
private DisplayListCanvas mCanvas;
+ private final boolean mIsWideColorGamut;
- HwuiContext() {
+ HwuiContext(boolean isWideColorGamut) {
mRenderNode = RenderNode.create("HwuiCanvas", null);
mRenderNode.setClipToBounds(false);
- mHwuiRenderer = nHwuiCreate(mRenderNode.mNativeRenderNode, mNativeObject);
+ mIsWideColorGamut = isWideColorGamut;
+ mHwuiRenderer = nHwuiCreate(mRenderNode.mNativeRenderNode, mNativeObject,
+ isWideColorGamut);
}
Canvas lockCanvas(int width, int height) {
@@ -864,9 +904,13 @@
mHwuiRenderer = 0;
}
}
+
+ boolean isWideColorGamut() {
+ return mIsWideColorGamut;
+ }
}
- private static native long nHwuiCreate(long rootNode, long surface);
+ private static native long nHwuiCreate(long rootNode, long surface, boolean isWideColorGamut);
private static native void nHwuiSetSurface(long renderer, long surface);
private static native void nHwuiDraw(long renderer);
private static native void nHwuiDestroy(long renderer);
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index fe49c02..27dd39b 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -37,6 +37,7 @@
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
@@ -4648,10 +4649,14 @@
return 0;
}
- protected final void showMagnifier(@NonNull final MotionEvent event) {
- if (mMagnifier == null) {
- return;
- }
+ /**
+ * Computes the position where the magnifier should be shown, relative to
+ * {@code mTextView}, and writes them to {@code showPosInView}. Also decides
+ * whether the magnifier should be shown or dismissed after this touch event.
+ * @return Whether the magnifier should be shown at the computed coordinates or dismissed.
+ */
+ private boolean obtainMagnifierShowCoordinates(@NonNull final MotionEvent event,
+ final PointF showPosInView) {
final int trigger = getMagnifierHandleTrigger();
final int offset;
@@ -4669,26 +4674,52 @@
}
if (offset == -1) {
- dismissMagnifier();
+ return false;
}
final Layout layout = mTextView.getLayout();
final int lineNumber = layout.getLineForOffset(offset);
- // Horizontally move the magnifier smoothly.
+
+ // Horizontally move the magnifier smoothly but clamp inside the current line.
final int[] textViewLocationOnScreen = new int[2];
mTextView.getLocationOnScreen(textViewLocationOnScreen);
- final float xPosInView = event.getRawX() - textViewLocationOnScreen[0];
+ final float touchXInView = event.getRawX() - textViewLocationOnScreen[0];
+ final float lineLeft = mTextView.getLayout().getLineLeft(lineNumber)
+ + mTextView.getTotalPaddingLeft() - mTextView.getScrollX();
+ final float lineRight = mTextView.getLayout().getLineRight(lineNumber)
+ + mTextView.getTotalPaddingLeft() - mTextView.getScrollX();
+ final float contentWidth = Math.round(mMagnifier.getWidth() / mMagnifier.getZoom());
+ if (touchXInView < lineLeft - contentWidth / 2
+ || touchXInView > lineRight + contentWidth / 2) {
+ // The touch is too out of the bounds of the current line, so hide the magnifier.
+ return false;
+ }
+ showPosInView.x = Math.max(lineLeft, Math.min(lineRight, touchXInView));
+
// Vertically snap to middle of current line.
- final float yPosInView = (mTextView.getLayout().getLineTop(lineNumber)
+ showPosInView.y = (mTextView.getLayout().getLineTop(lineNumber)
+ mTextView.getLayout().getLineBottom(lineNumber)) / 2.0f
+ mTextView.getTotalPaddingTop() - mTextView.getScrollY();
- // Make the cursor visible and stop blinking.
- mRenderCursorRegardlessTiming = true;
- mTextView.invalidateCursorPath();
- suspendBlink();
+ return true;
+ }
- mMagnifier.show(xPosInView, yPosInView);
+ protected final void updateMagnifier(@NonNull final MotionEvent event) {
+ if (mMagnifier == null) {
+ return;
+ }
+
+ final PointF showPosInView = new PointF();
+ final boolean shouldShow = obtainMagnifierShowCoordinates(event, showPosInView);
+ if (shouldShow) {
+ // Make the cursor visible and stop blinking.
+ mRenderCursorRegardlessTiming = true;
+ mTextView.invalidateCursorPath();
+ suspendBlink();
+ mMagnifier.show(showPosInView.x, showPosInView.y);
+ } else {
+ dismissMagnifier();
+ }
}
protected final void dismissMagnifier() {
@@ -4877,11 +4908,11 @@
case MotionEvent.ACTION_DOWN:
mDownPositionX = ev.getRawX();
mDownPositionY = ev.getRawY();
- showMagnifier(ev);
+ updateMagnifier(ev);
break;
case MotionEvent.ACTION_MOVE:
- showMagnifier(ev);
+ updateMagnifier(ev);
break;
case MotionEvent.ACTION_UP:
@@ -5235,11 +5266,11 @@
// re-engages the handle.
mTouchWordDelta = 0.0f;
mPrevX = UNSET_X_VALUE;
- showMagnifier(event);
+ updateMagnifier(event);
break;
case MotionEvent.ACTION_MOVE:
- showMagnifier(event);
+ updateMagnifier(event);
break;
case MotionEvent.ACTION_UP:
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index 85f68d7..3db149a 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -75,6 +75,8 @@
private final int mWindowWidth;
// The height of the window containing the magnifier.
private final int mWindowHeight;
+ // The zoom applied to the view region copied to the magnifier window.
+ private final float mZoom;
// The width of the bitmaps where the magnifier content is copied.
private final int mBitmapWidth;
// The height of the bitmaps where the magnifier content is copied.
@@ -111,10 +113,10 @@
com.android.internal.R.dimen.magnifier_height);
mWindowElevation = context.getResources().getDimension(
com.android.internal.R.dimen.magnifier_elevation);
- final float zoomScale = context.getResources().getFloat(
+ mZoom = context.getResources().getFloat(
com.android.internal.R.dimen.magnifier_zoom_scale);
- mBitmapWidth = Math.round(mWindowWidth / zoomScale);
- mBitmapHeight = Math.round(mWindowHeight / zoomScale);
+ mBitmapWidth = Math.round(mWindowWidth / mZoom);
+ mBitmapHeight = Math.round(mWindowHeight / mZoom);
// The view's surface coordinates will not be updated until the magnifier is first shown.
mViewCoordinatesInSurface = new int[2];
}
@@ -187,21 +189,6 @@
}
}
- @Nullable
- private Surface getValidViewSurface() {
- // TODO: deduplicate this against the first part of #performPixelCopy
- final Surface surface;
- if (mView instanceof SurfaceView) {
- surface = ((SurfaceView) mView).getHolder().getSurface();
- } else if (mView.getViewRootImpl() != null) {
- surface = mView.getViewRootImpl().mSurface;
- } else {
- surface = null;
- }
-
- return (surface != null && surface.isValid()) ? surface : null;
- }
-
/**
* Dismisses the magnifier from the screen. Calling this on a dismissed magnifier is a no-op.
*/
@@ -226,6 +213,44 @@
}
}
+ /**
+ * @return The width of the magnifier window, in pixels.
+ */
+ public int getWidth() {
+ return mWindowWidth;
+ }
+
+ /**
+ * @return The height of the magnifier window, in pixels.
+ */
+ public int getHeight() {
+ return mWindowHeight;
+ }
+
+ /**
+ * @return The zoom applied to the magnified view region copied to the magnifier window.
+ * If the zoom is x and the magnifier window size is (width, height), the original size
+ * of the content copied in the magnifier will be (width / x, height / x).
+ */
+ public float getZoom() {
+ return mZoom;
+ }
+
+ @Nullable
+ private Surface getValidViewSurface() {
+ // TODO: deduplicate this against the first part of #performPixelCopy
+ final Surface surface;
+ if (mView instanceof SurfaceView) {
+ surface = ((SurfaceView) mView).getHolder().getSurface();
+ } else if (mView.getViewRootImpl() != null) {
+ surface = mView.getViewRootImpl().mSurface;
+ } else {
+ surface = null;
+ }
+
+ return (surface != null && surface.isValid()) ? surface : null;
+ }
+
private void configureCoordinates(final float xPosInView, final float yPosInView) {
// Compute the coordinates of the center of the content going to be displayed in the
// magnifier. These are relative to the surface the content is copied from.
@@ -602,7 +627,7 @@
return null;
}
synchronized (mWindow.mLock) {
- return mWindow.mBitmap;
+ return Bitmap.createScaledBitmap(mWindow.mBitmap, mWindowWidth, mWindowHeight, true);
}
}
diff --git a/core/java/com/android/internal/util/NotificationMessagingUtil.java b/core/java/com/android/internal/util/NotificationMessagingUtil.java
index 518cf41..b962d4f 100644
--- a/core/java/com/android/internal/util/NotificationMessagingUtil.java
+++ b/core/java/com/android/internal/util/NotificationMessagingUtil.java
@@ -78,6 +78,10 @@
return false;
}
+ return isMessaging(sbn);
+ }
+
+ public boolean isMessaging(StatusBarNotification sbn) {
Class<? extends Notification.Style> style = sbn.getNotification().getNotificationStyle();
if (Notification.MessagingStyle.class.equals(style)) {
return true;
diff --git a/core/java/com/android/server/net/BaseNetdEventCallback.java b/core/java/com/android/server/net/BaseNetdEventCallback.java
new file mode 100644
index 0000000..3d3a3d0
--- /dev/null
+++ b/core/java/com/android/server/net/BaseNetdEventCallback.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.net;
+
+import android.net.INetdEventCallback;
+
+/**
+ * Base {@link INetdEventCallback} that provides no-op
+ * implementations which can be overridden.
+ *
+ * @hide
+ */
+public class BaseNetdEventCallback extends INetdEventCallback.Stub {
+ @Override
+ public void onDnsEvent(String hostname, String[] ipAddresses,
+ int ipAddressesCount, long timestamp, int uid) {
+ // default no-op
+ }
+
+ @Override
+ public void onConnectEvent(String ipAddr, int port, long timestamp, int uid) {
+ // default no-op
+ }
+}
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index f5c09fd..f70cf07 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -546,12 +546,16 @@
}
};
-static jlong create(JNIEnv* env, jclass clazz, jlong rootNodePtr, jlong surfacePtr) {
+static jlong create(JNIEnv* env, jclass clazz, jlong rootNodePtr, jlong surfacePtr,
+ jboolean isWideColorGamut) {
RenderNode* rootNode = reinterpret_cast<RenderNode*>(rootNodePtr);
sp<Surface> surface(reinterpret_cast<Surface*>(surfacePtr));
ContextFactory factory;
RenderProxy* proxy = new RenderProxy(false, rootNode, &factory);
proxy->loadSystemProperties();
+ if (isWideColorGamut) {
+ proxy->setWideGamut(true);
+ }
proxy->setSwapBehavior(SwapBehavior::kSwap_discardBuffer);
proxy->initialize(surface);
// Shadows can't be used via this interface, so just set the light source
@@ -620,7 +624,7 @@
{"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled},
// HWUI context
- {"nHwuiCreate", "(JJ)J", (void*) hwui::create },
+ {"nHwuiCreate", "(JJZ)J", (void*) hwui::create },
{"nHwuiSetSurface", "(JJ)V", (void*) hwui::setSurface },
{"nHwuiDraw", "(J)V", (void*) hwui::draw },
{"nHwuiDestroy", "(J)V", (void*) hwui::destroy },
diff --git a/core/proto/android/server/jobscheduler.proto b/core/proto/android/server/jobscheduler.proto
index 69abed3..9193129 100644
--- a/core/proto/android/server/jobscheduler.proto
+++ b/core/proto/android/server/jobscheduler.proto
@@ -614,7 +614,6 @@
CONSTRAINT_DEADLINE = 5;
CONSTRAINT_IDLE = 6;
CONSTRAINT_CONNECTIVITY = 7;
- CONSTRAINT_APP_NOT_IDLE = 8;
CONSTRAINT_CONTENT_TRIGGER = 9;
CONSTRAINT_DEVICE_NOT_DOZING = 10;
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index f1c9f67..cf13d1c 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2396,6 +2396,7 @@
<!-- depends on ImportanceExtractor-->
<item>com.android.server.notification.NotificationIntrusivenessExtractor</item>
<item>com.android.server.notification.VisibilityExtractor</item>
+ <!-- Depends on ZenModeExtractor -->
<item>com.android.server.notification.BadgeExtractor</item>
</string-array>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 15dffc0..a5bd179 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4883,7 +4883,7 @@
<!-- Title for the notification channel notifying user of settings system changes (i.e. Do Not Disturb has changed). [CHAR LIMIT=NONE] -->
<string name="notification_channel_system_changes">System changes</string>
<!-- Title of notification indicating do not disturb settings have changed when upgrading to P -->
- <string name="zen_upgrade_notification_title">Do Not Disturb has changed</string>
+ <string name="zen_upgrade_notification_title">Do Not Disturb is hiding notifications to help you focus</string>
<!-- Content of notification indicating users can tap on the notification to go to dnd behavior settings -->
- <string name="zen_upgrade_notification_content">Tap to check your behavior settings for interruptions</string>
+ <string name="zen_upgrade_notification_content">This is a new feature from the latest system update. Tap to change.</string>
</resources>
diff --git a/core/res/res/xml/default_zen_mode_config.xml b/core/res/res/xml/default_zen_mode_config.xml
index 5e463d8..2d3cd1c 100644
--- a/core/res/res/xml/default_zen_mode_config.xml
+++ b/core/res/res/xml/default_zen_mode_config.xml
@@ -18,7 +18,9 @@
-->
<!-- Default configuration for zen mode. See android.service.notification.ZenModeConfig. -->
-<zen version="4">
+<zen version="5">
<allow alarms="true" media="true" system="false" calls="false" messages="false" reminders="false"
events="false" />
+ <!-- all visual effects that exist as of P -->
+ <disallow suppressedVisualEffect="511" />
</zen>
diff --git a/data/etc/hiddenapi-package-whitelist.xml b/data/etc/hiddenapi-package-whitelist.xml
index 1d46d42..fd1027c 100644
--- a/data/etc/hiddenapi-package-whitelist.xml
+++ b/data/etc/hiddenapi-package-whitelist.xml
@@ -67,6 +67,7 @@
<hidden-api-whitelisted-app package="com.android.pacprocessor" />
<hidden-api-whitelisted-app package="com.android.phone" />
<hidden-api-whitelisted-app package="com.android.pmc" />
+ <hidden-api-whitelisted-app package="com.android.printspooler" />
<hidden-api-whitelisted-app package="com.android.providers.blockednumber" />
<hidden-api-whitelisted-app package="com.android.providers.contacts" />
<hidden-api-whitelisted-app package="com.android.providers.downloads" />
diff --git a/packages/SettingsLib/common.mk b/packages/SettingsLib/common.mk
index 3c2ca2d..3f9a0fd 100644
--- a/packages/SettingsLib/common.mk
+++ b/packages/SettingsLib/common.mk
@@ -48,7 +48,7 @@
# Include android-support-v7-preference, if not already included
ifeq (,$(findstring android-support-v7-preference,$(LOCAL_STATIC_JAVA_LIBRARIES)))
-LOCAL_RESOURCE_DIR += frameworks/support/v7/preference/res
+LOCAL_RESOURCE_DIR += frameworks/support/preference/res
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.preference
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-preference
endif
diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml
deleted file mode 100644
index 57b61da..0000000
--- a/packages/SystemUI/res/anim/ic_qs_signal_blink_1.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/linear_interpolator"
- android:duration="@integer/carrier_network_change_anim_time"
- android:repeatCount="-1">
-
- <propertyValuesHolder
- android:propertyName="fillColor"
- android:valueType="colorType">
- <keyframe
- android:fraction="0.0"
- android:value="#FFFFFFFF"/>
- <keyframe
- android:fraction="0.32"
- android:value="#FFFFFFFF"/>
- <keyframe
- android:fraction="0.33"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="1.0"
- android:value="#4DFFFFFF"/>
- </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml
deleted file mode 100644
index 09694c3..0000000
--- a/packages/SystemUI/res/anim/ic_qs_signal_blink_2.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<!--
- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/linear_interpolator"
- android:duration="@integer/carrier_network_change_anim_time"
- android:repeatCount="-1">
-
- <propertyValuesHolder
- android:propertyName="fillColor"
- android:valueType="colorType">
- <keyframe
- android:fraction="0.0"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="0.32"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="0.33"
- android:value="#FFFFFFFF"/>
- <keyframe
- android:fraction="0.66"
- android:value="#FFFFFFFF"/>
- <keyframe
- android:fraction="0.67"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="1.0"
- android:value="#4DFFFFFF"/>
- </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml b/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml
deleted file mode 100644
index 2270e3f..0000000
--- a/packages/SystemUI/res/anim/ic_qs_signal_blink_3.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/linear_interpolator"
- android:duration="@integer/carrier_network_change_anim_time"
- android:repeatCount="-1">
-
- <propertyValuesHolder
- android:propertyName="fillColor"
- android:valueType="colorType">
- <keyframe
- android:fraction="0.0"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="0.66"
- android:value="#4DFFFFFF"/>
- <keyframe
- android:fraction="0.67"
- android:value="#FFFFFFFF"/>
- <keyframe
- android:fraction="1.0"
- android:value="#FFFFFFFF"/>
- </propertyValuesHolder>
-
-</objectAnimator>
diff --git a/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml b/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml
new file mode 100644
index 0000000..382d9d5
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_1x_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M4,7h4v10H6V9H4V7z M15.83,11.72L18.66,7h-2.33l-1.66,2.77L13,7h-2.33l2.83,4.72L10.33,17h2.33l2-3.34l2,3.34H19 L15.83,11.72z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml
new file mode 100644
index 0000000..ce003e4
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_3g_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M3,7v2h5v2H4v2h4v2H3v2h5c1.1,0,2-0.9,2-2v-1.5c0-0.83-0.67-1.5-1.5-1.5c0.83,0,1.5-0.67,1.5-1.5V9c0-1.1-0.9-2-2-2H3z M21,11v4c0,1.1-0.9,2-2,2h-5c-1.1,0-2-0.9-2-2V9c0-1.1,0.9-2,2-2h5c1.1,0,2,0.9,2,2h-2h-5v6h5v-2h-2.5v-2H21z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml
new file mode 100644
index 0000000..8e22e06
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_4g_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M9,7H7v5H5V7H3v7h4v3h2v-3h2v-2H9V7z M17,11v2h2v2h-5V9h7c0-1.1-0.9-2-2-2h-5c-1.1,0-2,0.9-2,2v6c0,1.1,0.9,2,2,2h5 c1.1,0,2-0.9,2-2v-4H17z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml
new file mode 100644
index 0000000..32add0c
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_4g_plus_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M13,11v2h2v2h-4V9h6c0-1.1-0.9-2-2-2h-4C9.9,7,9,7.9,9,9v6c0,1.1,0.9,2,2,2h4c1.1,0,2-0.9,2-2v-4H13z M24,11h-2V9h-2v2h-2v2 h2v2h2v-2h2V11z M7,7H5v5H3V7H1v7h4v3h2v-3h1v-2H7V7z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_e_mobiledata.xml b/packages/SystemUI/res/drawable/ic_e_mobiledata.xml
new file mode 100644
index 0000000..80e507b
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_e_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M 16 9 L 16 7 L 8 7 L 8 17 L 16 17 L 16 15 L 10 15 L 10 13 L 16 13 L 16 11 L 10 11 L 10 9 Z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_g_mobiledata.xml b/packages/SystemUI/res/drawable/ic_g_mobiledata.xml
new file mode 100644
index 0000000..04049ce
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_g_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,11v2h2v2H9V9h0.44H14h2c0-1.1-0.9-2-2-2H9C7.9,7,7,7.9,7,9v6c0,1.1,0.9,2,2,2h5c1.1,0,2-0.9,2-2v-4H12z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_h_mobiledata.xml b/packages/SystemUI/res/drawable/ic_h_mobiledata.xml
new file mode 100644
index 0000000..31cc4a7
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_h_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M15,11H9V7H7v10h2v-4h6v4h2V7h-2V11z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml
new file mode 100644
index 0000000..ca1020e
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_h_plus_mobiledata.xml
@@ -0,0 +1,32 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M12,11H6V7H4v10h2v-4h6v4h2V7h-2V11z" />
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M22,11h-2V9h-2v2h-2v2h2v2h2v-2h2V11z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml b/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml
new file mode 100644
index 0000000..5d90965
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_lte_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M6,14h3v2H4V8h2V14z M9,10h2v6h2v-6h2V8H9V10z M21,10V8h-5v8h2h3v-2h-3v-0.67V13h3v-2h-3v-1H21z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml b/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml
new file mode 100644
index 0000000..0366e24
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_lte_plus_mobiledata.xml
@@ -0,0 +1,29 @@
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M3,14h3v2H1V8h2V14z M5,10h2v6h2v-6h2V8H5V10z M12,16h5v-2h-3v-1h3v-2h-3v-1h3V8h-5V16z M24,11h-2V9h-2v2h-2v2h2v2h2v-2h2 V11z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+ <path
+ android:pathData="M0,0h24v24H0V0z" />
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_0.xml b/packages/SystemUI/res/drawable/ic_qs_signal_0.xml
deleted file mode 100644
index b78d3bf..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_0.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:autoMirrored="true"
- android:width="32.0dp"
- android:height="32.0dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:pathData="M14.1,14.1l7.9,0.0 0.0,-11.5 -20.0,20.0 12.1,0.0z"
- android:fillAlpha="0.3"
- android:fillColor="#FFFFFF"/>
- <path
- android:pathData="M21.9,17.0l-1.1,-1.1 -1.9,1.9 -1.9,-1.9 -1.1,1.1 1.9,1.9 -1.9,1.9 1.1,1.1 1.9,-1.9 1.9,1.9 1.1,-1.1 -1.9,-1.9z"
- android:fillColor="#FFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_1x.xml b/packages/SystemUI/res/drawable/ic_qs_signal_1x.xml
deleted file mode 100644
index 5217748..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_1x.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12.0dp"
- android:height="24dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.600000,5.500000l1.200000,-3.000000l1.900000,0.000000L9.700000,6.700000l2.200000,4.300000L9.900000,11.000000L8.700000,7.900000L7.400000,11.000000L5.500000,11.000000l2.100000,-4.300000L5.600000,2.500000l1.900000,0.000000L8.600000,5.500000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_3g.xml b/packages/SystemUI/res/drawable/ic_qs_signal_3g.xml
deleted file mode 100644
index 546a96f..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_3g.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="15dp"
- android:height="24dp"
- android:viewportWidth="15.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.700000,9.000000 6.700000,7.900000L6.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000s-0.500000,-0.300000 -0.900000,-0.300000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S8.400000,5.000000 8.400000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.799999,7.800000L9.600000,7.800000L9.600000,6.600000l2.900000,0.000000L12.500000,9.900000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_4g.xml b/packages/SystemUI/res/drawable/ic_qs_signal_4g.xml
deleted file mode 100644
index 26b68c7..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_4g.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12.0dp"
- android:height="24dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.600000,7.800000l0.700000,0.000000l0.000000,1.300000L4.600000,9.100000L4.600000,11.000000L3.000000,11.000000L3.000000,9.200000L0.100000,9.200000L0.000000,8.100000L3.000000,2.500000l1.700000,0.000000L4.700000,7.800000zM1.600000,7.800000L3.000000,7.800000l0.000000,-3.000000L2.900000,5.000000L1.600000,7.800000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M11.900000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.100000,9.000000 6.100000,7.900000L6.100000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000S8.100000,2.400000 9.000000,2.400000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S9.500000,3.700000 9.000000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S7.700000,5.000000 7.700000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.099999,7.800000L9.000000,7.800000L9.000000,6.600000l2.900000,0.000000L11.900000,9.900000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_4g_plus.xml b/packages/SystemUI/res/drawable/ic_qs_signal_4g_plus.xml
deleted file mode 100644
index 6e4b4c5..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_4g_plus.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="15.0dp"
- android:height="20.0dp"
- android:viewportWidth="18.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.6,7.8l0.7,0.0l0.0,1.3L4.6,9.1L4.6,11.0L3.0,11.0L3.0,9.2L0.1,9.2L0.0,8.2l3.0,-5.7l1.7,0.0L4.6,7.8L4.6,7.8zM1.7,7.8L3.0,7.8l0.0,-3.0L2.9,5.0L1.7,7.8z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M11.9,9.9c-0.2,0.4 -0.6,0.7 -1.0,0.9s-1.0,0.4 -1.8,0.4c-0.9,0.0 -1.7,-0.3 -2.2,-0.8S6.1,9.0 6.1,7.9L6.1,5.6c0.0,-1.1 0.3,-1.9 0.8,-2.4S8.2,2.4 9.0,2.4c1.0,0.0 1.7,0.2 2.1,0.7s0.7,1.2 0.7,2.1l-1.6,0.0c0.0,-0.5 -0.1,-0.9 -0.2,-1.1S9.5,3.7 9.0,3.7c-0.4,0.0 -0.7,0.2 -0.9,0.5S7.8,5.0 7.8,5.6l0.0,2.3c0.0,0.7 0.1,1.1 0.3,1.4c0.2,0.3 0.6,0.5 1.0,0.5c0.3,0.0 0.6,0.0 0.7,-0.1s0.3,-0.2 0.4,-0.3L10.2,7.8L9.0,7.8L9.0,6.6l2.9,0.0L11.9,9.9z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M17.7,4.4l-1.900001,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.900001,0.0z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_disabled.xml b/packages/SystemUI/res/drawable/ic_qs_signal_disabled.xml
deleted file mode 100644
index c841a66..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_disabled.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:autoMirrored="true"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M21.799999,22.299999l-1.199999,-1.299999 0.000000,0.000000 -9.600000,-10.000000 0.000000,0.000000 -6.400000,-6.700000 -1.300000,1.300000 6.400000,6.700000 -8.700000,8.700000 16.900000,0.000000 2.600000,2.700001z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M21.000000,1.000000l-8.600000,8.600000 8.600000,9.100000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_e.xml b/packages/SystemUI/res/drawable/ic_qs_signal_e.xml
deleted file mode 100644
index f4b6ed8..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_e.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12dp"
- android:height="24dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <group
- android:translateX="3.5" >
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.400000,7.300000L1.700000,7.300000l0.000000,2.400000l3.300000,0.000000L5.000000,11.000000L0.000000,11.000000L0.000000,2.500000l4.900000,0.000000l0.000000,1.300000L1.700000,3.800000l0.000000,2.100000l2.800000,0.000000L4.500000,7.300000z"/>
- </group>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_g.xml b/packages/SystemUI/res/drawable/ic_qs_signal_g.xml
deleted file mode 100644
index 60a7f1e9..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_g.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12dp"
- android:height="24dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <group android:translateX="3.5" >
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
- </group>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_h.xml b/packages/SystemUI/res/drawable/ic_qs_signal_h.xml
deleted file mode 100644
index 4ffb4be..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_h.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="12dp"
- android:height="24dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <group
- android:translateX="3.5" >
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6.000000,11.000000L4.400000,11.000000L4.400000,7.500000L1.700000,7.500000L1.700000,11.000000L0.000000,11.000000L0.000000,2.500000l1.700000,0.000000l0.000000,3.700000l2.700000,0.000000L4.400000,2.500000L6.000000,2.500000L6.000000,11.000000z"/>
- </group>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_lte.xml b/packages/SystemUI/res/drawable/ic_qs_signal_lte.xml
deleted file mode 100644
index 816cd32..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_lte.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="11.9dp"
- android:height="22dp"
- android:viewportWidth="13.0"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.300000,3.800000L7.000000,3.800000L7.000000,11.000000L5.300000,11.000000L5.300000,3.800000L4.000000,3.800000L4.000000,2.500000l4.300000,0.000000L8.300000,3.800000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.400000,7.300000l-1.700000,0.000000l0.000000,2.400000l2.100000,0.000000L12.799999,11.000000L9.000000,11.000000L9.000000,2.500000l3.700000,0.000000l0.000000,1.300000l-2.100000,0.000000l0.000000,2.100000l1.700000,0.000000L12.300000,7.300000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_lte_plus.xml b/packages/SystemUI/res/drawable/ic_qs_signal_lte_plus.xml
deleted file mode 100644
index 4c43e13..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_lte_plus.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="15.0dp"
- android:height="19.5dp"
- android:viewportWidth="18.5"
- android:viewportHeight="24.0"
- android:tint="?android:attr/colorControlNormal">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.0,9.7l2.0,0.0L4.0,11.0L0.4,11.0L0.4,2.5L2.0,2.5L2.0,9.7z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.3,3.8L7.0,3.8L7.0,11.0L5.4,11.0L5.4,3.8L4.0,3.8L4.0,2.5l4.3,0.0L8.3,3.8z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.4,7.3l-1.7,0.0l0.0,2.4l2.1,0.0L12.799999,11.0L9.0,11.0L9.0,2.5l3.7,0.0l0.0,1.3l-2.1,0.0l0.0,2.1l1.7,0.0L12.4,7.3L12.4,7.3z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M18.4,4.4l-1.9,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.9,0.0z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_signal_no_signal.xml b/packages/SystemUI/res/drawable/ic_qs_signal_no_signal.xml
deleted file mode 100644
index c8c857c..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_signal_no_signal.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:autoMirrored="true"
- android:width="32dp"
- android:height="32dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.000000,22.000000l20.000000,0.000000L22.000000,2.000000L2.000000,22.000000zM20.000000,20.000000L6.800000,20.000000L20.000000,6.800000L20.000000,20.000000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_swap_vert.xml b/packages/SystemUI/res/drawable/ic_swap_vert.xml
new file mode 100644
index 0000000..eed79ff
--- /dev/null
+++ b/packages/SystemUI/res/drawable/ic_swap_vert.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z" />
+</vector>
\ No newline at end of file
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_1x.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_1x.xml
deleted file mode 100644
index d7463a4..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_1x.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="8.5dp"
- android:height="17dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M3.500000,11.000000L1.800000,11.000000L1.800000,4.400000L0.200000,5.100000L0.200000,3.700000l3.100000,-1.300000l0.200000,0.000000L3.500000,11.000000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.600000,5.500000l1.200000,-3.000000l1.900000,0.000000L9.700000,6.700000l2.200000,4.300000L9.900000,11.000000L8.700000,7.900000L7.400000,11.000000L5.500000,11.000000l2.100000,-4.300000L5.600000,2.500000l1.900000,0.000000L8.600000,5.500000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_3g.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_3g.xml
deleted file mode 100644
index 6309b6d..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_3g.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="9.208dp"
- android:height="17dp"
- android:viewportWidth="13.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.000000,6.000000l0.800000,0.000000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000s0.200000,-0.500000 0.200000,-0.900000c0.000000,-0.300000 -0.100000,-0.600000 -0.200000,-0.800000S3.200000,3.700000 2.900000,3.700000C2.700000,3.700000 2.500000,3.800000 2.300000,4.000000S2.100000,4.400000 2.100000,4.700000L0.500000,4.700000C0.500000,4.000000 0.700000,3.400000 1.100000,3.000000s1.000000,-0.600000 1.700000,-0.600000c0.800000,0.000000 1.400000,0.200000 1.900000,0.600000s0.700000,1.000000 0.700000,1.800000c0.000000,0.400000 -0.100000,0.700000 -0.300000,1.100000S4.600000,6.500000 4.300000,6.600000C4.700000,6.800000 5.000000,7.100000 5.200000,7.400000s0.300000,0.700000 0.300000,1.200000c0.000000,0.800000 -0.200000,1.400000 -0.700000,1.800000s-1.100000,0.700000 -1.900000,0.700000c-0.700000,0.000000 -1.300000,-0.200000 -1.800000,-0.600000s-0.700000,-1.000000 -0.700000,-1.800000L2.000000,8.700000C2.000000,9.000000 2.100000,9.300000 2.300000,9.500000s0.400000,0.300000 0.600000,0.300000c0.300000,0.000000 0.500000,-0.100000 0.700000,-0.300000S3.900000,9.000000 3.900000,8.600000c0.000000,-0.500000 -0.100000,-0.800000 -0.300000,-1.000000S3.200000,7.300000 2.800000,7.300000L2.000000,7.300000L2.000000,6.000000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.700000,9.000000 6.700000,7.900000L6.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000s-0.500000,-0.300000 -0.900000,-0.300000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S8.400000,5.000000 8.400000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.799999,7.800000L9.600000,7.800000L9.600000,6.600000l2.900000,0.000000L12.500000,9.900000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g.xml
deleted file mode 100644
index 4067ae5..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="8.5dp"
- android:height="17dp"
- android:viewportWidth="12.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.600000,7.800000l0.700000,0.000000l0.000000,1.300000L4.600000,9.100000L4.600000,11.000000L3.000000,11.000000L3.000000,9.200000L0.100000,9.200000L0.000000,8.100000L3.000000,2.500000l1.700000,0.000000L4.700000,7.800000zM1.600000,7.800000L3.000000,7.800000l0.000000,-3.000000L2.900000,5.000000L1.600000,7.800000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M11.900000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S6.100000,9.000000 6.100000,7.900000L6.100000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000S8.100000,2.400000 9.000000,2.400000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000l-1.600000,0.000000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S9.500000,3.700000 9.000000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S7.700000,5.000000 7.700000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L10.099999,7.800000L9.000000,7.800000L9.000000,6.600000l2.900000,0.000000L11.900000,9.900000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g_plus.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g_plus.xml
deleted file mode 100644
index 719a6ca..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_4g_plus.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="10.5dp"
- android:height="14.0dp"
- android:viewportWidth="18.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.6,7.8l0.7,0.0l0.0,1.3L4.6,9.1L4.6,11.0L3.0,11.0L3.0,9.2L0.1,9.2L0.0,8.2l3.0,-5.7l1.7,0.0L4.6,7.8L4.6,7.8zM1.7,7.8L3.0,7.8l0.0,-3.0L2.9,5.0L1.7,7.8z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M11.9,9.9c-0.2,0.4 -0.6,0.7 -1.0,0.9s-1.0,0.4 -1.8,0.4c-0.9,0.0 -1.7,-0.3 -2.2,-0.8S6.1,9.0 6.1,7.9L6.1,5.6c0.0,-1.1 0.3,-1.9 0.8,-2.4S8.2,2.4 9.0,2.4c1.0,0.0 1.7,0.2 2.1,0.7s0.7,1.2 0.7,2.1l-1.6,0.0c0.0,-0.5 -0.1,-0.9 -0.2,-1.1S9.5,3.7 9.0,3.7c-0.4,0.0 -0.7,0.2 -0.9,0.5S7.8,5.0 7.8,5.6l0.0,2.3c0.0,0.7 0.1,1.1 0.3,1.4c0.2,0.3 0.6,0.5 1.0,0.5c0.3,0.0 0.6,0.0 0.7,-0.1s0.3,-0.2 0.4,-0.3L10.2,7.8L9.0,7.8L9.0,6.6l2.9,0.0L11.9,9.9z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M17.7,4.4l-1.900001,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.900001,0.0z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_e.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_e.xml
deleted file mode 100644
index acaa9b1..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_e.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="3.541dp"
- android:height="17dp"
- android:viewportWidth="5.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M4.400000,7.300000L1.700000,7.300000l0.000000,2.400000l3.300000,0.000000L5.000000,11.000000L0.000000,11.000000L0.000000,2.500000l4.900000,0.000000l0.000000,1.300000L1.700000,3.800000l0.000000,2.100000l2.800000,0.000000L4.500000,7.300000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_g.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_g.xml
deleted file mode 100644
index 7985237..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_g.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="4.958dp"
- android:height="17dp"
- android:viewportWidth="7.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6.500000,9.900000c-0.200000,0.400000 -0.600000,0.700000 -1.000000,0.900000s-1.000000,0.400000 -1.800000,0.400000c-0.900000,0.000000 -1.700000,-0.300000 -2.200000,-0.800000S0.700000,9.000000 0.700000,7.900000L0.700000,5.600000c0.000000,-1.100000 0.300000,-1.900000 0.800000,-2.400000s1.200000,-0.800000 2.100000,-0.800000c1.000000,0.000000 1.700000,0.200000 2.100000,0.700000s0.700000,1.200000 0.700000,2.100000L4.700000,5.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.200000,-1.100000S4.000000,3.700000 3.600000,3.700000c-0.400000,0.000000 -0.700000,0.200000 -0.900000,0.500000S2.300000,5.000000 2.300000,5.600000l0.000000,2.300000c0.000000,0.700000 0.100000,1.100000 0.300000,1.400000s0.600000,0.500000 1.000000,0.500000c0.300000,0.000000 0.600000,0.000000 0.700000,-0.100000s0.300000,-0.200000 0.400000,-0.300000L4.700000,7.800000L3.500000,7.800000L3.500000,6.600000l2.900000,0.000000L6.400000,9.900000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_h.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_h.xml
deleted file mode 100644
index fda8761..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_h.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="4.25dp"
- android:height="17dp"
- android:viewportWidth="6.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M6.000000,11.000000L4.400000,11.000000L4.400000,7.500000L1.700000,7.500000L1.700000,11.000000L0.000000,11.000000L0.000000,2.500000l1.700000,0.000000l0.000000,3.700000l2.700000,0.000000L4.400000,2.500000L6.000000,2.500000L6.000000,11.000000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte.xml
deleted file mode 100644
index c08ff20..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="9.208dp"
- android:height="17dp"
- android:viewportWidth="13.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.000000,9.700000l2.000000,0.000000L4.000000,11.000000L0.300000,11.000000L0.300000,2.500000L2.000000,2.500000L2.000000,9.700000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.300000,3.800000L7.000000,3.800000L7.000000,11.000000L5.300000,11.000000L5.300000,3.800000L4.000000,3.800000L4.000000,2.500000l4.300000,0.000000L8.300000,3.800000z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.400000,7.300000l-1.700000,0.000000l0.000000,2.400000l2.100000,0.000000L12.799999,11.000000L9.000000,11.000000L9.000000,2.500000l3.700000,0.000000l0.000000,1.300000l-2.100000,0.000000l0.000000,2.100000l1.700000,0.000000L12.300000,7.300000z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte_plus.xml b/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte_plus.xml
deleted file mode 100644
index 62159b3..0000000
--- a/packages/SystemUI/res/drawable/stat_sys_data_fully_connected_lte_plus.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--
- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="11.08dp"
- android:height="14.0dp"
- android:viewportWidth="19.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M2.0,9.7l2.0,0.0L4.0,11.0L0.4,11.0L0.4,2.5L2.0,2.5L2.0,9.7z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M8.3,3.8L7.0,3.8L7.0,11.0L5.4,11.0L5.4,3.8L4.0,3.8L4.0,2.5l4.3,0.0L8.3,3.8z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M12.4,7.3l-1.7,0.0l0.0,2.4l2.1,0.0L12.799999,11.0L9.0,11.0L9.0,2.5l3.7,0.0l0.0,1.3l-2.1,0.0l0.0,2.1l1.7,0.0L12.4,7.3L12.4,7.3z"/>
- <path
- android:fillColor="#FFFFFFFF"
- android:pathData="M18.4,4.4l-1.9,0.0 0.0,-1.9 -1.2,0.0 0.0,1.9 -1.900001,0.0 0.0,1.2 1.900001,0.0 0.0,1.9 1.2,0.0 0.0,-1.9 1.9,0.0z"/>
-</vector>
diff --git a/packages/SystemUI/res/layout/mobile_signal_group.xml b/packages/SystemUI/res/layout/mobile_signal_group.xml
index b8ed09e..2e92042 100644
--- a/packages/SystemUI/res/layout/mobile_signal_group.xml
+++ b/packages/SystemUI/res/layout/mobile_signal_group.xml
@@ -16,17 +16,18 @@
** limitations under the License.
*/
-->
-<LinearLayout
+<com.android.keyguard.AlphaOptimizedLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:id="@+id/mobile_combo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- >
+ android:layout_gravity="center_vertical"
+ android:orientation="horizontal">
<FrameLayout
android:layout_height="17dp"
- android:layout_width="wrap_content">
+ android:layout_width="wrap_content"
+ android:layout_gravity="center_vertical">
<ImageView
android:id="@+id/mobile_in"
android:layout_height="wrap_content"
@@ -44,9 +45,16 @@
android:visibility="gone"
/>
</FrameLayout>
+ <ImageView
+ android:id="@+id/mobile_type"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone" />
<FrameLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
<com.android.systemui.statusbar.AnimatedImageView
android:theme="@style/DualToneLightTheme"
android:id="@+id/mobile_signal"
@@ -63,11 +71,6 @@
systemui:hasOverlappingRendering="false"
/>
<ImageView
- android:id="@+id/mobile_type"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- />
- <ImageView
android:id="@+id/mobile_roaming"
android:layout_width="wrap_content"
android:layout_height="17dp"
@@ -79,4 +82,4 @@
android:contentDescription="@string/data_connection_roaming"
android:visibility="gone" />
</FrameLayout>
-</LinearLayout>
+</com.android.keyguard.AlphaOptimizedLinearLayout>
diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml
index 759d1ed..b1cb6cf 100644
--- a/packages/SystemUI/res/layout/notification_info.xml
+++ b/packages/SystemUI/res/layout/notification_info.xml
@@ -29,6 +29,7 @@
<!-- Package Info -->
<RelativeLayout
+ android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="false"
@@ -140,6 +141,12 @@
android:layout_height="match_parent"
style="@style/TextAppearance.NotificationInfo.Button"/>
<TextView
+ android:id="@+id/minimize"
+ android:text="@string/inline_minimize_button"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ style="@style/TextAppearance.NotificationInfo.Button" />
+ <TextView
android:id="@+id/keep"
android:text="@string/inline_keep_button"
android:layout_width="wrap_content"
@@ -157,10 +164,11 @@
android:visibility="gone"
android:orientation="horizontal" >
<TextView
+ android:id="@+id/confirmation_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notification_channel_disabled"
- style="@style/TextAppearance.NotificationInfo.Secondary.Warning"/>
+ style="@style/TextAppearance.NotificationInfo.Confirmation"/>
<TextView
android:id="@+id/undo"
android:layout_width="wrap_content"
diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml
index 9bf7870..7500bc6 100644
--- a/packages/SystemUI/res/layout/qs_footer_impl.xml
+++ b/packages/SystemUI/res/layout/qs_footer_impl.xml
@@ -43,6 +43,14 @@
android:layout_gravity="center_vertical"
android:gravity="end" >
+ <include
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical|start"
+ android:layout_margin="15dp"
+ android:visibility="gone"
+ layout="@layout/mobile_signal_group" />
+
<com.android.keyguard.CarrierText
android:id="@+id/qs_carrier_text"
android:layout_width="0dp"
diff --git a/packages/SystemUI/res/layout/volume_dialog.xml b/packages/SystemUI/res/layout/volume_dialog.xml
index b6d241b..0063f6a 100644
--- a/packages/SystemUI/res/layout/volume_dialog.xml
+++ b/packages/SystemUI/res/layout/volume_dialog.xml
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.android.systemui.volume.VolumeUiLayout
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -89,4 +89,4 @@
</LinearLayout>
</LinearLayout>
-</com.android.systemui.volume.VolumeUiLayout>
\ No newline at end of file
+</FrameLayout>
\ No newline at end of file
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 89e6da3..4bd997d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1526,6 +1526,9 @@
<!-- Notification Inline Controls: Shown when a channel's notifications are currently blocked -->
<string name="notification_channel_disabled">You won\'t see these notifications anymore</string>
+ <!-- Notification inline controls: Shown when a channel's notifications are minimized -->
+ <string name="notification_channel_minimized">These notifications will be minimized</string>
+
<!-- Notification Inline controls: continue receiving notifications prompt, channel level -->
<string name="inline_blocking_helper">You usually dismiss these notifications.
\nKeep showing them?</string>
@@ -1539,6 +1542,9 @@
<!-- Notification inline controls: keep getting notifications button -->
<string name="inline_keep_button">Keep showing</string>
+ <!-- Notification inline controls: minimize notifications button -->
+ <string name="inline_minimize_button">Minimize</string>
+
<!-- Notification Inline controls: continue receiving notifications prompt, app level -->
<string name="inline_keep_showing_app">Keep showing notifications from this app?</string>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index d006af1..1470dfa 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -335,6 +335,7 @@
<style name="qs_theme" parent="qs_base">
<item name="lightIconTheme">@style/QSIconTheme</item>
<item name="darkIconTheme">@style/QSIconTheme</item>
+ <item name="android:windowIsFloating">true</item>
</style>
<style name="systemui_theme_remote_input" parent="@android:style/Theme.DeviceDefault.Light">
@@ -345,7 +346,9 @@
<style name="Theme.SystemUI.Dialog.Alert" parent="@*android:style/Theme.DeviceDefault.Light.Dialog.Alert" />
- <style name="Theme.SystemUI.Dialog.GlobalActions" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen" />
+ <style name="Theme.SystemUI.Dialog.GlobalActions" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen">
+ <item name="android:windowIsFloating">true</item>
+ </style>
<style name="QSBorderlessButton">
<item name="android:padding">12dp</item>
@@ -456,6 +459,12 @@
<item name="android:alpha">0.87</item>
</style>
+ <style name="TextAppearance.NotificationInfo.Confirmation">
+ <item name="android:textColor">?android:attr/textColorPrimary</item>
+ <item name="android:textSize">14sp</item>
+ <item name="android:alpha">0.87</item>
+ </style>
+
<style name="TextAppearance.NotificationInfo.Secondary">
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textSize">14sp</item>
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierText.java b/packages/SystemUI/src/com/android/keyguard/CarrierText.java
index 45d1aad8..5b0f1c3 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierText.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierText.java
@@ -39,9 +39,15 @@
import com.android.internal.telephony.IccCardConstants.State;
import com.android.internal.telephony.TelephonyIntents;
import com.android.settingslib.WirelessUtils;
+
import android.telephony.TelephonyManager;
public class CarrierText extends TextView {
+ /** Do not show missing sim message. */
+ public static final int FLAG_HIDE_MISSING_SIM = 1 << 0;
+ /** Do not show airplane mode message. */
+ public static final int FLAG_HIDE_AIRPLANE_MODE = 1 << 1;
+
private static final boolean DEBUG = KeyguardConstants.DEBUG;
private static final String TAG = "CarrierText";
@@ -55,6 +61,8 @@
private boolean[] mSimErrorState = new boolean[TelephonyManager.getDefault().getPhoneCount()];
+ private int mFlags;
+
private KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
@Override
public void onRefreshCarrierInfo() {
@@ -85,6 +93,11 @@
}
};
};
+
+ public void setDisplayFlags(int flags) {
+ mFlags = flags;
+ }
+
/**
* The status of this lock screen. Primarily used for widgets on LockScreen.
*/
@@ -196,8 +209,7 @@
// Grab the first subscripton, because they all should contain the emergency text,
// described above.
displayText = makeCarrierStringOnEmergencyCapable(
- getContext().getText(R.string.keyguard_missing_sim_message_short),
- subs.get(0).getCarrierName());
+ getMissingSimMessage(), subs.get(0).getCarrierName());
} else {
// We don't have a SubscriptionInfo to get the emergency calls only from.
// Grab it from the old sticky broadcast if possible instead. We can use it
@@ -223,8 +235,7 @@
text = concatenate(plmn, spn);
}
}
- displayText = makeCarrierStringOnEmergencyCapable(
- getContext().getText(R.string.keyguard_missing_sim_message_short), text);
+ displayText = makeCarrierStringOnEmergencyCapable(getMissingSimMessage(), text);
}
}
@@ -232,11 +243,21 @@
// APM (airplane mode) != no carrier state. There are carrier services
// (e.g. WFC = Wi-Fi calling) which may operate in APM.
if (!anySimReadyAndInService && WirelessUtils.isAirplaneModeOn(mContext)) {
- displayText = getContext().getString(R.string.airplane_mode);
+ displayText = getAirplaneModeMessage();
}
setText(displayText);
}
+ private String getMissingSimMessage() {
+ return (mFlags & FLAG_HIDE_MISSING_SIM) == 0
+ ? getContext().getString(R.string.keyguard_missing_sim_message_short) : "";
+ }
+
+ private String getAirplaneModeMessage() {
+ return (mFlags & FLAG_HIDE_AIRPLANE_MODE) == 0
+ ? getContext().getString(R.string.airplane_mode) : "";
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
index 6f43a18..e171b53 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java
@@ -14,6 +14,7 @@
package com.android.systemui.globalactions;
+import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
@@ -1356,11 +1357,17 @@
// Window initialization
Window window = getWindow();
window.requestFeature(Window.FEATURE_NO_TITLE);
- window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND
- | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
+ // Inflate the decor view, so the attributes below are not overwritten by the theme.
+ window.getDecorView();
+ window.getAttributes().systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+ window.setLayout(MATCH_PARENT, MATCH_PARENT);
+ window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.addFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index 3563437..a1adfa6 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -15,12 +15,14 @@
package com.android.systemui.globalactions;
import static android.app.StatusBarManager.DISABLE2_GLOBAL_ACTIONS;
+import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Point;
+import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
@@ -80,15 +82,21 @@
com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
// Window initialization
Window window = d.getWindow();
+ window.requestFeature(Window.FEATURE_NO_TITLE);
+ window.getAttributes().systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
+ // Inflate the decor view, so the attributes below are not overwritten by the theme.
+ window.getDecorView();
window.getAttributes().width = ViewGroup.LayoutParams.MATCH_PARENT;
window.getAttributes().height = ViewGroup.LayoutParams.MATCH_PARENT;
+ window.getAttributes().layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
- window.requestFeature(Window.FEATURE_NO_TITLE);
- window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND
- | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
+ window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
window.addFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
index e9888df..dbf1745 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.content.Intent;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
@@ -27,6 +28,7 @@
import android.os.UserManager;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.View.OnClickListener;
@@ -36,15 +38,18 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.keyguard.CarrierText;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.settingslib.Utils;
import com.android.settingslib.drawable.UserIconDrawable;
+import com.android.settingslib.graph.SignalDrawable;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.R.dimen;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.qs.TouchAnimator.Builder;
+import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.MultiUserSwitch;
import com.android.systemui.statusbar.phone.SettingsButton;
@@ -64,7 +69,7 @@
private UserInfoController mUserInfoController;
private SettingsButton mSettingsButton;
protected View mSettingsContainer;
- private View mCarrierText;
+ private CarrierText mCarrierText;
private boolean mQsDisabled;
private QSPanel mQsPanel;
@@ -86,9 +91,15 @@
private View mActionsContainer;
private View mDragHandle;
+ private View mMobileGroup;
+ private ImageView mMobileSignal;
+ private ImageView mMobileRoaming;
+ private final int mColorForeground;
+ private final CellSignalState mInfo = new CellSignalState();
public QSFooterImpl(Context context, AttributeSet attrs) {
super(context, attrs);
+ mColorForeground = Utils.getColorAttr(context, android.R.attr.colorForeground);
}
@Override
@@ -104,7 +115,12 @@
mSettingsContainer = findViewById(R.id.settings_button_container);
mSettingsButton.setOnClickListener(this);
+ mMobileGroup = findViewById(R.id.mobile_combo);
+ mMobileSignal = findViewById(R.id.mobile_signal);
+ mMobileRoaming = findViewById(R.id.mobile_roaming);
mCarrierText = findViewById(R.id.qs_carrier_text);
+ mCarrierText.setDisplayFlags(
+ CarrierText.FLAG_HIDE_AIRPLANE_MODE | CarrierText.FLAG_HIDE_MISSING_SIM);
mMultiUserSwitch = findViewById(R.id.multi_user_switch);
mMultiUserAvatar = mMultiUserSwitch.findViewById(R.id.multi_user_avatar);
@@ -165,6 +181,7 @@
return new TouchAnimator.Builder()
.addFloat(mDivider, "alpha", 0, 1)
.addFloat(mCarrierText, "alpha", 0, 0, 1)
+ .addFloat(mMobileGroup, "alpha", 0, 1)
.addFloat(mActionsContainer, "alpha", 0, 1)
.addFloat(mDragHandle, "alpha", 1, 0, 0)
.setStartDelay(0.15f)
@@ -338,4 +355,64 @@
}
mMultiUserAvatar.setImageDrawable(picture);
}
+
+ private void handleUpdateState() {
+ mMobileGroup.setVisibility(mInfo.visible ? View.VISIBLE : View.GONE);
+ if (mInfo.visible) {
+ mMobileRoaming.setVisibility(mInfo.roaming ? View.VISIBLE : View.GONE);
+ mMobileRoaming.setImageTintList(ColorStateList.valueOf(mColorForeground));
+ SignalDrawable d = new SignalDrawable(mContext);
+ d.setDarkIntensity(QuickStatusBarHeader.getColorIntensity(mColorForeground));
+ mMobileSignal.setImageDrawable(d);
+ mMobileSignal.setImageLevel(mInfo.mobileSignalIconId);
+
+ StringBuilder contentDescription = new StringBuilder();
+ if (mInfo.contentDescription != null) {
+ contentDescription.append(mInfo.contentDescription).append(", ");
+ }
+ if (mInfo.roaming) {
+ contentDescription
+ .append(mContext.getString(R.string.data_connection_roaming))
+ .append(", ");
+ }
+ // TODO: show mobile data off/no internet text for 5 seconds before carrier text
+ if (TextUtils.equals(mInfo.typeContentDescription,
+ mContext.getString(R.string.data_connection_no_internet))
+ || TextUtils.equals(mInfo.typeContentDescription,
+ mContext.getString(R.string.cell_data_off))) {
+ contentDescription.append(mInfo.typeContentDescription);
+ }
+ mMobileSignal.setContentDescription(contentDescription);
+ }
+ }
+
+ @Override
+ public void setMobileDataIndicators(NetworkController.IconState statusIcon,
+ NetworkController.IconState qsIcon, int statusType,
+ int qsType, boolean activityIn, boolean activityOut,
+ String typeContentDescription,
+ String description, boolean isWide, int subId, boolean roaming) {
+ mInfo.visible = statusIcon.visible;
+ mInfo.mobileSignalIconId = statusIcon.icon;
+ mInfo.contentDescription = statusIcon.contentDescription;
+ mInfo.typeContentDescription = typeContentDescription;
+ mInfo.roaming = roaming;
+ handleUpdateState();
+ }
+
+ @Override
+ public void setNoSims(boolean hasNoSims, boolean simDetected) {
+ if (hasNoSims) {
+ mInfo.visible = false;
+ }
+ handleUpdateState();
+ }
+
+ private final class CellSignalState {
+ boolean visible;
+ int mobileSignalIconId;
+ public String contentDescription;
+ String typeContentDescription;
+ boolean roaming;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index ec4d1a6..0548e69 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -18,6 +18,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.annotation.ColorInt;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.content.Context;
@@ -128,7 +129,7 @@
Rect tintArea = new Rect(0, 0, 0, 0);
int colorForeground = Utils.getColorAttr(getContext(), android.R.attr.colorForeground);
- float intensity = colorForeground == Color.WHITE ? 0 : 1;
+ float intensity = getColorIntensity(colorForeground);
int fillColor = fillColorForIntensity(intensity, getContext());
// Set light text on the header icons because they will always be on a black background
@@ -443,4 +444,9 @@
.getBestDateTimePattern(Locale.getDefault(), skeleton);
return android.text.format.DateFormat.format(pattern, info.getTriggerTime()).toString();
}
+
+ public static float getColorIntensity(@ColorInt int color) {
+ return color == Color.WHITE ? 0 : 1;
+ }
+
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 57ff1c3..b7a64e1 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -18,12 +18,9 @@
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.pm.PackageManager;
import android.content.res.Resources;
-import android.os.SystemProperties;
import android.provider.Settings;
import android.service.quicksettings.Tile;
import android.text.TextUtils;
@@ -32,6 +29,7 @@
import android.view.ViewGroup;
import android.view.WindowManager.LayoutParams;
import android.widget.Switch;
+
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settingslib.net.DataUsageController;
@@ -43,7 +41,6 @@
import com.android.systemui.plugins.qs.QSIconView;
import com.android.systemui.plugins.qs.QSTile.SignalState;
import com.android.systemui.qs.CellTileView;
-import com.android.systemui.qs.CellTileView.SignalIcon;
import com.android.systemui.qs.QSHost;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.statusbar.phone.SystemUIDialog;
@@ -159,31 +156,15 @@
final Resources r = mContext.getResources();
state.activityIn = cb.enabled && cb.activityIn;
state.activityOut = cb.enabled && cb.activityOut;
- state.isOverlayIconWide = cb.isDataTypeIconWide;
- state.overlayIconId = cb.dataTypeIconId;
-
state.label = r.getString(R.string.mobile_data);
-
- final String signalContentDesc = cb.enabled && (cb.mobileSignalIconId > 0)
- ? cb.signalContentDescription
- : r.getString(R.string.accessibility_no_signal);
boolean mobileDataEnabled = mDataController.isMobileDataSupported()
&& mDataController.isMobileDataEnabled();
state.value = mobileDataEnabled;
- if (cb.noSim) {
- state.contentDescription = state.label;
- } else {
- state.contentDescription = signalContentDesc + ", " + state.label;
- }
-
state.expandedAccessibilityClassName = Switch.class.getName();
- state.value = mDataController.isMobileDataSupported()
- && mDataController.isMobileDataEnabled();
-
if (cb.noSim) {
state.icon = ResourceIcon.get(R.drawable.ic_qs_no_sim);
} else {
- state.icon = new SignalIcon(cb.mobileSignalIconId);
+ state.icon = ResourceIcon.get(R.drawable.ic_swap_vert);
}
if (cb.noSim) {
@@ -199,6 +180,7 @@
state.state = Tile.STATE_INACTIVE;
state.secondaryLabel = r.getString(R.string.cell_data_off);
}
+ state.contentDescription = state.label + ", " + state.secondaryLabel;
}
private CharSequence getMobileDataDescription(CallbackInfo cb) {
@@ -223,40 +205,18 @@
return mController.hasMobileDataFeature();
}
- // Remove the period from the network name
- public static String removeTrailingPeriod(String string) {
- if (string == null) return null;
- final int length = string.length();
- if (string.endsWith(".")) {
- return string.substring(0, length - 1);
- }
- return string;
- }
-
private static final class CallbackInfo {
boolean enabled;
- boolean wifiEnabled;
boolean airplaneModeEnabled;
- int mobileSignalIconId;
- String signalContentDescription;
- int dataTypeIconId;
String dataContentDescription;
boolean activityIn;
boolean activityOut;
- String enabledDesc;
boolean noSim;
- boolean isDataTypeIconWide;
boolean roaming;
}
private final class CellSignalCallback implements SignalCallback {
private final CallbackInfo mInfo = new CallbackInfo();
- @Override
- public void setWifiIndicators(boolean enabled, IconState statusIcon, IconState qsIcon,
- boolean activityIn, boolean activityOut, String description, boolean isTransient) {
- mInfo.wifiEnabled = enabled;
- refreshState(mInfo);
- }
@Override
public void setMobileDataIndicators(IconState statusIcon, IconState qsIcon, int statusType,
@@ -267,14 +227,9 @@
return;
}
mInfo.enabled = qsIcon.visible;
- mInfo.mobileSignalIconId = qsIcon.icon;
- mInfo.signalContentDescription = qsIcon.contentDescription;
- mInfo.dataTypeIconId = qsType;
mInfo.dataContentDescription = typeContentDescription;
mInfo.activityIn = activityIn;
mInfo.activityOut = activityOut;
- mInfo.enabledDesc = description;
- mInfo.isDataTypeIconWide = qsType != 0 && isWide;
mInfo.roaming = roaming;
refreshState(mInfo);
}
@@ -282,16 +237,6 @@
@Override
public void setNoSims(boolean show, boolean simDetected) {
mInfo.noSim = show;
- if (mInfo.noSim) {
- // Make sure signal gets cleared out when no sims.
- mInfo.mobileSignalIconId = 0;
- mInfo.dataTypeIconId = 0;
- // Show a No SIMs description to avoid emergency calls message.
- mInfo.enabled = true;
- mInfo.enabledDesc = mContext.getString(
- R.string.keyguard_missing_sim_message_short);
- mInfo.signalContentDescription = mInfo.enabledDesc;
- }
refreshState(mInfo);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index d53cb03..22a186f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -16,6 +16,13 @@
package com.android.systemui.statusbar;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
+
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.Notification;
@@ -445,20 +452,47 @@
return Ranking.VISIBILITY_NO_OVERRIDE;
}
- public boolean shouldSuppressScreenOff(String key) {
+ public boolean shouldSuppressFullScreenIntent(String key) {
if (mRankingMap != null) {
getRanking(key, mTmpRanking);
return (mTmpRanking.getSuppressedVisualEffects()
- & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) != 0;
+ & SUPPRESSED_EFFECT_FULL_SCREEN_INTENT) != 0;
}
return false;
}
- public boolean shouldSuppressScreenOn(String key) {
+ public boolean shouldSuppressPeek(String key) {
if (mRankingMap != null) {
getRanking(key, mTmpRanking);
return (mTmpRanking.getSuppressedVisualEffects()
- & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON) != 0;
+ & SUPPRESSED_EFFECT_PEEK) != 0;
+ }
+ return false;
+ }
+
+ public boolean shouldSuppressStatusBar(String key) {
+ if (mRankingMap != null) {
+ getRanking(key, mTmpRanking);
+ return (mTmpRanking.getSuppressedVisualEffects()
+ & SUPPRESSED_EFFECT_STATUS_BAR) != 0;
+ }
+ return false;
+ }
+
+ public boolean shouldSuppressAmbient(String key) {
+ if (mRankingMap != null) {
+ getRanking(key, mTmpRanking);
+ return (mTmpRanking.getSuppressedVisualEffects()
+ & SUPPRESSED_EFFECT_AMBIENT) != 0;
+ }
+ return false;
+ }
+
+ public boolean shouldSuppressNotificationList(String key) {
+ if (mRankingMap != null) {
+ getRanking(key, mTmpRanking);
+ return (mTmpRanking.getSuppressedVisualEffects()
+ & SUPPRESSED_EFFECT_NOTIFICATION_LIST) != 0;
}
return false;
}
@@ -576,6 +610,14 @@
return true;
}
+ if (mEnvironment.isDozing() && shouldSuppressAmbient(sbn.getKey())) {
+ return true;
+ }
+
+ if (!mEnvironment.isDozing() && shouldSuppressNotificationList(sbn.getKey())) {
+ return true;
+ }
+
if (!StatusBar.ENABLE_CHILD_NOTIFICATIONS
&& mGroupManager.isChildInGroupWithSummary(sbn)) {
return true;
@@ -670,5 +712,9 @@
public boolean isNotificationForCurrentProfiles(StatusBarNotification sbn);
public String getCurrentMediaNotificationKey();
public NotificationGroupManager getGroupManager();
+ /**
+ * @return true iff the device is dozing
+ */
+ boolean isDozing();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
index 146de00..48828ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationEntryManager.java
@@ -304,11 +304,7 @@
return true;
}
- if (mPowerManager.isInteractive()) {
- return mNotificationData.shouldSuppressScreenOn(key);
- } else {
- return mNotificationData.shouldSuppressScreenOff(key);
- }
+ return mNotificationData.shouldSuppressFullScreenIntent(key);
}
private void inflateViews(NotificationData.Entry entry, ViewGroup parent) {
@@ -849,12 +845,13 @@
return false;
}
- if (!mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOn(sbn.getKey())) {
+ if (!mPresenter.isDozing() && mNotificationData.shouldSuppressPeek(sbn.getKey())) {
if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
return false;
}
- if (mPresenter.isDozing() && mNotificationData.shouldSuppressScreenOff(sbn.getKey())) {
+ // Peeking triggers an ambient display pulse, so disable peek is ambient is active
+ if (mPresenter.isDozing() && mNotificationData.shouldSuppressAmbient(sbn.getKey())) {
if (DEBUG) Log.d(TAG, "No peeking: suppressed by DND: " + sbn.getKey());
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
index afe906c..b1ad30c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
+import static android.app.NotificationManager.IMPORTANCE_MIN;
import static android.app.NotificationManager.IMPORTANCE_NONE;
import android.animation.Animator;
@@ -39,6 +40,7 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
+import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -73,6 +75,7 @@
private boolean mNonblockable;
private StatusBarNotification mSbn;
private AnimatorSet mExpandAnimation;
+ private boolean mIsForeground;
private CheckSaveListener mCheckSaveListener;
private OnSettingsClickListener mOnSettingsClickListener;
@@ -84,7 +87,7 @@
closeControls(v);
};
- private OnClickListener mOnStopNotifications = v -> {
+ private OnClickListener mOnStopMinNotifications = v -> {
swapContent(false);
};
@@ -150,6 +153,8 @@
mSingleNotificationChannel = notificationChannel;
mStartingUserImportance = mChosenImportance = mSingleNotificationChannel.getImportance();
mNegativeUserSentiment = negativeUserSentiment;
+ mIsForeground =
+ (mSbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0;
int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage(
pkg, mAppUid, false /* includeDeleted */);
@@ -290,14 +295,23 @@
private void bindButtons() {
View block = findViewById(R.id.block);
- block.setOnClickListener(mOnStopNotifications);
+ block.setOnClickListener(mOnStopMinNotifications);
TextView keep = findViewById(R.id.keep);
keep.setOnClickListener(mOnKeepShowing);
findViewById(R.id.undo).setOnClickListener(mOnUndo);
+ View minimize = findViewById(R.id.minimize);
+ minimize.setOnClickListener(mOnStopMinNotifications);
if (mNonblockable) {
keep.setText(R.string.notification_done);
block.setVisibility(GONE);
+ minimize.setVisibility(GONE);
+ } else if (mIsForeground) {
+ block.setVisibility(GONE);
+ minimize.setVisibility(VISIBLE);
+ } else if (!mIsForeground) {
+ block.setVisibility(VISIBLE);
+ minimize.setVisibility(GONE);
}
// app settings link
@@ -306,7 +320,7 @@
mSbn.getId(), mSbn.getTag());
if (settingsIntent != null
&& !TextUtils.isEmpty(mSbn.getNotification().getSettingsText())) {
- settingsLinkView.setVisibility(View.VISIBLE);
+ settingsLinkView.setVisibility(VISIBLE);
settingsLinkView.setText(mContext.getString(R.string.notification_app_settings,
mSbn.getNotification().getSettingsText()));
settingsLinkView.setOnClickListener((View view) -> {
@@ -322,14 +336,21 @@
mExpandAnimation.cancel();
}
+ View prompt = findViewById(R.id.prompt);
+ ViewGroup confirmation = findViewById(R.id.confirmation);
+ TextView confirmationText = findViewById(R.id.confirmation_text);
+ View header = findViewById(R.id.header);
+
if (showPrompt) {
mChosenImportance = mStartingUserImportance;
+ } else if (mIsForeground) {
+ mChosenImportance = IMPORTANCE_MIN;
+ confirmationText.setText(R.string.notification_channel_minimized);
} else {
mChosenImportance = IMPORTANCE_NONE;
+ confirmationText.setText(R.string.notification_channel_disabled);
}
- View prompt = findViewById(R.id.prompt);
- View confirmation = findViewById(R.id.confirmation);
ObjectAnimator promptAnim = ObjectAnimator.ofFloat(prompt, View.ALPHA,
prompt.getAlpha(), showPrompt ? 1f : 0f);
promptAnim.setInterpolator(showPrompt ? Interpolators.ALPHA_IN : Interpolators.ALPHA_OUT);
@@ -339,6 +360,7 @@
prompt.setVisibility(showPrompt ? VISIBLE : GONE);
confirmation.setVisibility(showPrompt ? GONE : VISIBLE);
+ header.setVisibility(showPrompt ? VISIBLE : GONE);
mExpandAnimation = new AnimatorSet();
mExpandAnimation.playTogether(promptAnim, confirmAnim);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
index 5263bb4..21d3d81 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationPresenter.java
@@ -101,11 +101,6 @@
void updateNotificationViews();
/**
- * @return true iff the device is dozing
- */
- boolean isDozing();
-
- /**
* Returns the maximum number of notifications to show while locked.
*
* @param recompute whether something has changed that means we should recompute this value
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java
new file mode 100644
index 0000000..5c21fd1
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/VibratorHelper.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar;
+
+import android.content.Context;
+import android.database.ContentObserver;
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.UserHandle;
+import android.os.VibrationEffect;
+import android.os.Vibrator;
+import android.provider.Settings;
+
+public class VibratorHelper {
+
+ private final Vibrator mVibrator;
+ private final Context mContext;
+ private boolean mHapticFeedbackEnabled;
+
+ final private ContentObserver mVibrationObserver = new ContentObserver(Handler.getMain()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ updateHapticFeedBackEnabled();
+ }
+ };
+
+ public VibratorHelper(Context context) {
+ mContext = context;
+ mVibrator = context.getSystemService(Vibrator.class);
+
+ mContext.getContentResolver().registerContentObserver(
+ Settings.System.getUriFor(Settings.System.HAPTIC_FEEDBACK_ENABLED), true,
+ mVibrationObserver);
+ mVibrationObserver.onChange(false /* selfChange */);
+ }
+
+ public void vibrate(final int effectId) {
+ if (mHapticFeedbackEnabled) {
+ AsyncTask.execute(() ->
+ mVibrator.vibrate(VibrationEffect.get(effectId, false /* fallback */)));
+ }
+ }
+
+ private void updateHapticFeedBackEnabled() {
+ mHapticFeedbackEnabled = Settings.System.getIntForUser(mContext.getContentResolver(),
+ Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) != 0;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index c5269ad..1361cc4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -20,7 +20,6 @@
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -29,21 +28,19 @@
import android.view.DisplayCutout;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
+import android.view.WindowInsets;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.android.internal.statusbar.StatusBarIcon;
import com.android.settingslib.Utils;
import com.android.systemui.BatteryMeterView;
import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
-import com.android.systemui.statusbar.phone.StatusBarIconController.IconManager;
import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -210,18 +207,26 @@
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
- private void updateLayoutConsideringCutout() {
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ if (updateLayoutConsideringCutout()) {
+ requestLayout();
+ }
+ return super.onApplyWindowInsets(insets);
+ }
+
+ private boolean updateLayoutConsideringCutout() {
DisplayCutout dc = getRootWindowInsets().getDisplayCutout();
if (dc == null) {
- updateLayoutParamsNoCutout();
+ return updateLayoutParamsNoCutout();
} else {
- updateLayoutParamsForCutout(dc);
+ return updateLayoutParamsForCutout(dc);
}
}
- private void updateLayoutParamsNoCutout() {
+ private boolean updateLayoutParamsNoCutout() {
if (mLayoutState == LAYOUT_NO_CUTOUT) {
- return;
+ return false;
}
mLayoutState = LAYOUT_NO_CUTOUT;
@@ -240,11 +245,12 @@
(LinearLayout.LayoutParams) mSystemIconsContainer.getLayoutParams();
llp.setMarginStart(getResources().getDimensionPixelSize(
R.dimen.system_icons_super_container_margin_start));
+ return true;
}
- private void updateLayoutParamsForCutout(DisplayCutout dc) {
+ private boolean updateLayoutParamsForCutout(DisplayCutout dc) {
if (mLayoutState == LAYOUT_CUTOUT) {
- return;
+ return false;
}
mLayoutState = LAYOUT_CUTOUT;
@@ -268,6 +274,7 @@
LinearLayout.LayoutParams llp =
(LinearLayout.LayoutParams) mSystemIconsContainer.getLayoutParams();
llp.setMarginStart(0);
+ return true;
}
//TODO: Something is setting signal_cluster to MATCH_PARENT. Why?
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 056874f..ca5a350 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -39,6 +39,7 @@
import android.os.Handler;
import android.os.Message;
import android.os.SystemProperties;
+import android.os.VibrationEffect;
import android.support.annotation.ColorInt;
import android.util.AttributeSet;
import android.util.Log;
@@ -67,6 +68,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.NavigationBarCompat;
import com.android.systemui.stackdivider.Divider;
+import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.policy.DeadZone;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
import com.android.systemui.statusbar.policy.TintedKeyButtonDrawable;
@@ -148,6 +150,7 @@
private Divider mDivider;
private RecentsOnboarding mRecentsOnboarding;
private NotificationPanelView mPanelView;
+ private final VibratorHelper mVibratorHelper;
private int mRotateBtnStyle = R.style.RotateButtonCCWStart90;
@@ -243,6 +246,7 @@
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
mRecentsOnboarding = new RecentsOnboarding(context, mOverviewProxyService);
+ mVibratorHelper = new VibratorHelper(context);
mConfiguration = new Configuration();
mConfiguration.updateFrom(context.getResources().getConfiguration());
@@ -311,6 +315,9 @@
} else if (mRecentsButtonBounds.contains(x, y)) {
mDownHitTarget = HIT_TARGET_OVERVIEW;
}
+
+ // Vibrate tick whenever down occurs on navigation bar
+ mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
break;
}
return mGestureHelper.onInterceptTouchEvent(event);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
index e77b135..e1aed7a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java
@@ -141,7 +141,7 @@
}
// showAmbient == show in shade but not shelf
- if (!showAmbient && notificationData.shouldSuppressScreenOn(entry.key)) {
+ if (!showAmbient && notificationData.shouldSuppressStatusBar(entry.key)) {
return false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 9c2a0e5..7c91a40 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -50,6 +50,7 @@
import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.StatusBarState;
+import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import java.io.FileDescriptor;
@@ -66,7 +67,6 @@
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mPanelUpdateWhenAnimatorEnds;
private boolean mVibrateOnOpening;
- private boolean mVibrationEnabled;
protected boolean mLaunchingNotification;
private int mFixedDuration = NO_FIXED_DURATION;
@@ -110,13 +110,7 @@
private FlingAnimationUtils mFlingAnimationUtilsClosing;
private FlingAnimationUtils mFlingAnimationUtilsDismissing;
private FalsingManager mFalsingManager;
- private final Vibrator mVibrator;
- final private ContentObserver mVibrationObserver = new ContentObserver(Handler.getMain()) {
- @Override
- public void onChange(boolean selfChange) {
- updateHapticFeedBackEnabled();
- }
- };
+ private final VibratorHelper mVibratorHelper;
/**
* Whether an instant expand request is currently pending and we are just waiting for layout.
@@ -218,18 +212,9 @@
mFalsingManager = FalsingManager.getInstance(context);
mNotificationsDragEnabled =
getResources().getBoolean(R.bool.config_enableNotificationShadeDrag);
- mVibrator = mContext.getSystemService(Vibrator.class);
+ mVibratorHelper = new VibratorHelper(context);
mVibrateOnOpening = mContext.getResources().getBoolean(
R.bool.config_vibrateOnIconAnimation);
- mContext.getContentResolver().registerContentObserver(
- Settings.System.getUriFor(Settings.System.HAPTIC_FEEDBACK_ENABLED), true,
- mVibrationObserver);
- mVibrationObserver.onChange(false /* selfChange */);
- }
-
- public void updateHapticFeedBackEnabled() {
- mVibrationEnabled = Settings.System.getIntForUser(mContext.getContentResolver(),
- Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) != 0;
}
protected void loadDimens() {
@@ -421,9 +406,8 @@
runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(),
false /* collapseWhenFinished */);
notifyBarPanelExpansionChanged();
- if (mVibrateOnOpening && mVibrationEnabled) {
- AsyncTask.execute(() ->
- mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK, false)));
+ if (mVibrateOnOpening) {
+ mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
}
//TODO: keyguard opens QS a different way; log that too?
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 900ec0b..cf5c1c0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -28,6 +28,7 @@
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
@@ -37,7 +38,8 @@
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.DarkIconDispatcher;
import com.android.systemui.statusbar.policy.DarkIconDispatcher.DarkReceiver;
-import com.android.systemui.util.leak.RotationUtils;
+
+import java.util.Objects;
public class PhoneStatusBarView extends PanelBar {
private static final String TAG = "PhoneStatusBarView";
@@ -98,7 +100,7 @@
// Always have Battery meters in the status bar observe the dark/light modes.
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mBattery);
if (updateOrientationAndCutout(getResources().getConfiguration().orientation)) {
- postUpdateLayoutForCutout();
+ updateLayoutForCutout();
}
}
@@ -115,10 +117,20 @@
// May trigger cutout space layout-ing
if (updateOrientationAndCutout(newConfig.orientation)) {
- postUpdateLayoutForCutout();
+ updateLayoutForCutout();
+ requestLayout();
}
}
+ @Override
+ public WindowInsets onApplyWindowInsets(WindowInsets insets) {
+ if (updateOrientationAndCutout(mLastOrientation)) {
+ updateLayoutForCutout();
+ requestLayout();
+ }
+ return super.onApplyWindowInsets(insets);
+ }
+
/**
*
* @param newOrientation may pass NO_VALUE for no change
@@ -133,12 +145,9 @@
}
}
- if (mDisplayCutout == null) {
- DisplayCutout cutout = getRootWindowInsets().getDisplayCutout();
- if (cutout != null) {
- changed = true;
- mDisplayCutout = cutout;
- }
+ if (!Objects.equals(getRootWindowInsets().getDisplayCutout(), mDisplayCutout)) {
+ changed = true;
+ mDisplayCutout = getRootWindowInsets().getDisplayCutout();
}
return changed;
@@ -276,17 +285,6 @@
updateSafeInsets();
}
- private void postUpdateLayoutForCutout() {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- updateLayoutForCutout();
- }
- };
- // Let the cutout emulation draw first
- postDelayed(r, 0);
- }
-
private void updateCutoutLocation() {
// Not all layouts have a cutout (e.g., Car)
if (mCutoutSpace == null) {
@@ -310,40 +308,13 @@
// or letterboxing from the right or left sides.
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
- if (mDisplayCutout == null || mDisplayCutout.isEmpty()) {
+ if (mDisplayCutout == null) {
lp.leftMargin = 0;
lp.rightMargin = 0;
return;
}
- int leftMargin = 0;
- int rightMargin = 0;
- switch (RotationUtils.getRotation(getContext())) {
- /*
- * Landscape: <-|
- * Seascape: |->
- */
- case RotationUtils.ROTATION_LANDSCAPE:
- leftMargin = getDisplayCutoutHeight();
- break;
- case RotationUtils.ROTATION_SEASCAPE:
- rightMargin = getDisplayCutoutHeight();
- break;
- default:
- break;
- }
-
- lp.leftMargin = leftMargin;
- lp.rightMargin = rightMargin;
- }
-
- //TODO: Find a better way
- private int getDisplayCutoutHeight() {
- if (mDisplayCutout == null || mDisplayCutout.isEmpty()) {
- return 0;
- }
-
- Rect r = mDisplayCutout.getBoundingRect();
- return r.bottom - r.top;
+ lp.leftMargin = mDisplayCutout.getSafeInsetLeft();
+ lp.rightMargin = mDisplayCutout.getSafeInsetRight();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index d3fbe27..899b936 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -4603,6 +4603,7 @@
if (mAmbientIndicationContainer instanceof DozeReceiver) {
((DozeReceiver) mAmbientIndicationContainer).setDozing(mDozing);
}
+ mEntryManager.updateNotifications();
updateDozingState();
updateReportRejectedTouchVisibility();
Trace.endSection();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
index aec05cd..a59f054 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyButtonView.java
@@ -27,12 +27,9 @@
import android.metrics.LogMaker;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.SystemClock;
import android.os.VibrationEffect;
-import android.os.Vibrator;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.TypedValue;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
@@ -53,6 +50,7 @@
import com.android.systemui.R;
import com.android.systemui.plugins.statusbar.phone.NavBarButtonProvider.ButtonInterface;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.statusbar.VibratorHelper;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK;
@@ -75,7 +73,7 @@
private OnClickListener mOnClickListener;
private final KeyButtonRipple mRipple;
private final OverviewProxyService mOverviewProxyService;
- private final Vibrator mVibrator;
+ private final VibratorHelper mVibratorHelper;
private final MetricsLogger mMetricsLogger = Dependency.get(MetricsLogger.class);
private final Runnable mCheckLongPress = new Runnable() {
@@ -128,7 +126,7 @@
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
mRipple = new KeyButtonRipple(context, this);
- mVibrator = mContext.getSystemService(Vibrator.class);
+ mVibratorHelper = new VibratorHelper(context);
mOverviewProxyService = Dependency.get(OverviewProxyService.class);
setBackground(mRipple);
}
@@ -263,14 +261,17 @@
break;
case MotionEvent.ACTION_UP:
final boolean doIt = mIsPressed && !mLongClicked;
+ final boolean doHapticFeedback = (SystemClock.uptimeMillis() - mDownTime) > 150;
if (isProxyConnected) {
if (doIt) {
// Animate the ripple in on touch up with setPressed and then out later
setPressed(true);
- performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ if (doHapticFeedback) {
+ mVibratorHelper.vibrate(VibrationEffect.EFFECT_TICK);
+ }
playSoundEffect(SoundEffectConstants.CLICK);
}
- } else if ((SystemClock.uptimeMillis() - mDownTime) > 150 && !mLongClicked) {
+ } else if (doHapticFeedback && !mLongClicked) {
// Always send a release ourselves because it doesn't seem to be sent elsewhere
// and it feels weird to sometimes get a release haptic and other times not.
performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY_RELEASE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
index aa24402..487d1c5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java
@@ -579,14 +579,13 @@
public MobileIconGroup(String name, int[][] sbIcons, int[][] qsIcons, int[] contentDesc,
int sbNullState, int qsNullState, int sbDiscState, int qsDiscState,
- int discContentDesc, int dataContentDesc, int dataType, boolean isWide,
- int qsDataType) {
+ int discContentDesc, int dataContentDesc, int dataType, boolean isWide) {
super(name, sbIcons, qsIcons, contentDesc, sbNullState, qsNullState, sbDiscState,
qsDiscState, discContentDesc);
mDataContentDescription = dataContentDesc;
mDataType = dataType;
mIsWide = isWide;
- mQsDataType = qsDataType;
+ mQsDataType = dataType; // TODO: remove this field
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
index d610400..986abef 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/TelephonyIcons.java
@@ -21,28 +21,19 @@
class TelephonyIcons {
//***** Data connection icons
-
- static final int QS_DATA_G = R.drawable.ic_qs_signal_g;
- static final int QS_DATA_3G = R.drawable.ic_qs_signal_3g;
- static final int QS_DATA_E = R.drawable.ic_qs_signal_e;
- static final int QS_DATA_H = R.drawable.ic_qs_signal_h;
- static final int QS_DATA_1X = R.drawable.ic_qs_signal_1x;
- static final int QS_DATA_4G = R.drawable.ic_qs_signal_4g;
- static final int QS_DATA_4G_PLUS = R.drawable.ic_qs_signal_4g_plus;
- static final int QS_DATA_LTE = R.drawable.ic_qs_signal_lte;
- static final int QS_DATA_LTE_PLUS = R.drawable.ic_qs_signal_lte_plus;
-
static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
- static final int ICON_LTE = R.drawable.stat_sys_data_fully_connected_lte;
- static final int ICON_LTE_PLUS = R.drawable.stat_sys_data_fully_connected_lte_plus;
- static final int ICON_G = R.drawable.stat_sys_data_fully_connected_g;
- static final int ICON_E = R.drawable.stat_sys_data_fully_connected_e;
- static final int ICON_H = R.drawable.stat_sys_data_fully_connected_h;
- static final int ICON_3G = R.drawable.stat_sys_data_fully_connected_3g;
- static final int ICON_4G = R.drawable.stat_sys_data_fully_connected_4g;
- static final int ICON_4G_PLUS = R.drawable.stat_sys_data_fully_connected_4g_plus;
- static final int ICON_1X = R.drawable.stat_sys_data_fully_connected_1x;
+ static final int ICON_LTE = R.drawable.ic_lte_mobiledata;
+ static final int ICON_LTE_PLUS = R.drawable.ic_lte_plus_mobiledata;
+ static final int ICON_G = R.drawable.ic_g_mobiledata;
+ static final int ICON_E = R.drawable.ic_e_mobiledata;
+ static final int ICON_H = R.drawable.ic_h_mobiledata;
+ // TODO: add logic to insert H+ icon
+ static final int ICON_H_PLUS = R.drawable.ic_h_plus_mobiledata;
+ static final int ICON_3G = R.drawable.ic_3g_mobiledata;
+ static final int ICON_4G = R.drawable.ic_4g_mobiledata;
+ static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata;
+ static final int ICON_1X = R.drawable.ic_1x_mobiledata;
static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
"CARRIER_NETWORK_CHANGE",
@@ -55,9 +46,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.carrier_network_change_mode,
0,
- false,
- 0
- );
+ false);
static final MobileIconGroup THREE_G = new MobileIconGroup(
"3G",
@@ -70,9 +59,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_3g,
TelephonyIcons.ICON_3G,
- true,
- TelephonyIcons.QS_DATA_3G
- );
+ true);
static final MobileIconGroup WFC = new MobileIconGroup(
"WFC",
@@ -83,8 +70,7 @@
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0, 0, false, 0
- );
+ 0, 0, false);
static final MobileIconGroup UNKNOWN = new MobileIconGroup(
"Unknown",
@@ -95,8 +81,7 @@
0,
0,
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
- 0, 0, false, 0
- );
+ 0, 0, false);
static final MobileIconGroup E = new MobileIconGroup(
"E",
@@ -109,9 +94,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_edge,
TelephonyIcons.ICON_E,
- false,
- TelephonyIcons.QS_DATA_E
- );
+ false);
static final MobileIconGroup ONE_X = new MobileIconGroup(
"1X",
@@ -124,9 +107,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_cdma,
TelephonyIcons.ICON_1X,
- true,
- TelephonyIcons.QS_DATA_1X
- );
+ true);
static final MobileIconGroup G = new MobileIconGroup(
"G",
@@ -139,9 +120,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_gprs,
TelephonyIcons.ICON_G,
- false,
- TelephonyIcons.QS_DATA_G
- );
+ false);
static final MobileIconGroup H = new MobileIconGroup(
"H",
@@ -154,9 +133,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_3_5g,
TelephonyIcons.ICON_H,
- false,
- TelephonyIcons.QS_DATA_H
- );
+ false);
static final MobileIconGroup FOUR_G = new MobileIconGroup(
"4G",
@@ -169,9 +146,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_4g,
TelephonyIcons.ICON_4G,
- true,
- TelephonyIcons.QS_DATA_4G
- );
+ true);
static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
"4G+",
@@ -184,9 +159,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_4g_plus,
TelephonyIcons.ICON_4G_PLUS,
- true,
- TelephonyIcons.QS_DATA_4G_PLUS
- );
+ true);
static final MobileIconGroup LTE = new MobileIconGroup(
"LTE",
@@ -199,9 +172,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_lte,
TelephonyIcons.ICON_LTE,
- true,
- TelephonyIcons.QS_DATA_LTE
- );
+ true);
static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
"LTE+",
@@ -214,9 +185,7 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.data_connection_lte_plus,
TelephonyIcons.ICON_LTE_PLUS,
- true,
- TelephonyIcons.QS_DATA_LTE_PLUS
- );
+ true);
static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
"DataDisabled",
@@ -229,8 +198,6 @@
AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
R.string.cell_data_off,
0,
- false,
- 0
- );
+ false);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 716b58841..fe21f87 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -207,8 +207,6 @@
rescheduleTimeoutH();
return true;
});
- VolumeUiLayout uiLayout = VolumeUiLayout.get(mDialogView);
- uiLayout.updateRotation();
mDialogRowsView = mDialog.findViewById(R.id.volume_dialog_rows);
mRinger = mDialog.findViewById(R.id.ringer);
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUiLayout.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUiLayout.java
deleted file mode 100644
index 0a3a2ab..0000000
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUiLayout.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package com.android.systemui.volume;
-
-import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
-import android.animation.ObjectAnimator;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.graphics.Rect;
-import android.util.AttributeSet;
-import android.view.DisplayCutout;
-import android.view.View;
-import android.view.ViewOutlineProvider;
-import android.view.ViewTreeObserver;
-import android.widget.FrameLayout;
-
-import com.android.systemui.R;
-import com.android.systemui.util.leak.RotationUtils;
-
-public class VolumeUiLayout extends FrameLayout {
-
- private View mChild;
- private int mRotation = ROTATION_NONE;
- @Nullable
- private DisplayCutout mDisplayCutout;
-
- public VolumeUiLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
- }
-
- @Override
- protected void onDetachedFromWindow() {
- super.onDetachedFromWindow();
- mDisplayCutout = null;
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- if (mChild == null) {
- if (getChildCount() != 0) {
- mChild = getChildAt(0);
- updateRotation();
- } else {
- return;
- }
- }
- }
-
- @Override
- protected void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- updateRotation();
- }
-
- private void setDisplayCutout() {
- if (mDisplayCutout == null && getRootWindowInsets() != null) {
- DisplayCutout cutout = getRootWindowInsets().getDisplayCutout();
- if (cutout != null) {
- mDisplayCutout = cutout;
- }
- }
- }
-
- public void updateRotation() {
- setDisplayCutout();
- if (mChild == null) {
- if (getChildCount() != 0) {
- mChild = getChildAt(0);
- }
- }
- int rotation = RotationUtils.getRotation(getContext());
- if (rotation != mRotation) {
- updateSafeInsets(rotation);
- mRotation = rotation;
- }
- }
-
- private void updateSafeInsets(int rotation) {
- // Depending on our rotation, we may have to work around letterboxing from the right
- // side from the navigation bar or a cutout.
-
- MarginLayoutParams lp = (MarginLayoutParams) mChild.getLayoutParams();
-
- int margin = (int) getResources().getDimension(R.dimen.volume_dialog_base_margin);
- switch (rotation) {
- /*
- * Landscape: <-|. Have to deal with the nav bar
- * Seascape: |->. Have to deal with the cutout
- */
- case RotationUtils.ROTATION_LANDSCAPE:
- margin += getNavBarHeight();
- break;
- case RotationUtils.ROTATION_SEASCAPE:
- margin += getDisplayCutoutHeight();
- break;
- default:
- break;
- }
-
- lp.rightMargin = margin;
- mChild.setLayoutParams(lp);
- }
-
- private int getNavBarHeight() {
- return (int) getResources().getDimension(R.dimen.navigation_bar_size);
- }
-
- //TODO: Find a better way
- private int getDisplayCutoutHeight() {
- if (mDisplayCutout == null || mDisplayCutout.isEmpty()) {
- return 0;
- }
-
- Rect r = mDisplayCutout.getBoundingRect();
- return r.bottom - r.top;
- }
-
- @Override
- public ViewOutlineProvider getOutlineProvider() {
- return super.getOutlineProvider();
- }
-
- public static VolumeUiLayout get(View v) {
- if (v instanceof VolumeUiLayout) return (VolumeUiLayout) v;
- if (v.getParent() instanceof View) {
- return get((View) v.getParent());
- }
- return null;
- }
-}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
index b8d9b19..01664b2 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
@@ -18,6 +18,8 @@
import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE;
import static android.app.NotificationManager.IMPORTANCE_LOW;
+import static android.app.NotificationManager.IMPORTANCE_MIN;
+import static android.app.NotificationManager.IMPORTANCE_NONE;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
import static android.print.PrintManager.PRINT_SPOOLER_PACKAGE_NAME;
import static android.view.View.GONE;
@@ -147,6 +149,7 @@
TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
final TextView textView = mNotificationInfo.findViewById(R.id.pkgname);
assertTrue(textView.getText().toString().contains("App Name"));
+ assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
}
@Test
@@ -213,6 +216,27 @@
}
@Test
+ public void testBindNotification_BlockButton() throws Exception {
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
+ final View block = mNotificationInfo.findViewById(R.id.block);
+ final View minimize = mNotificationInfo.findViewById(R.id.minimize);
+ assertEquals(VISIBLE, block.getVisibility());
+ assertEquals(GONE, minimize.getVisibility());
+ }
+
+ @Test
+ public void testBindNotification_MinButton() throws Exception {
+ mSbn.getNotification().flags = Notification.FLAG_FOREGROUND_SERVICE;
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
+ final View block = mNotificationInfo.findViewById(R.id.block);
+ final View minimize = mNotificationInfo.findViewById(R.id.minimize);
+ assertEquals(GONE, block.getVisibility());
+ assertEquals(VISIBLE, minimize.getVisibility());
+ }
+
+ @Test
public void testBindNotification_SetsOnClickListenerForSettings() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
@@ -324,6 +348,18 @@
}
@Test
+ public void testDoesNotUpdateNotificationChannelAfterImportanceChangedMin()
+ throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
+
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
+ anyString(), eq(TEST_UID), any());
+ }
+
+ @Test
public void testHandleCloseControls_DoesNotUpdateNotificationChannelIfUnchanged()
throws Exception {
int originalImportance = mNotificationChannel.getImportance();
@@ -377,6 +413,39 @@
anyString(), eq(TEST_UID), updated.capture());
assertTrue((updated.getValue().getUserLockedFields()
& USER_LOCKED_IMPORTANCE) != 0);
+ assertEquals(IMPORTANCE_NONE, updated.getValue().getImportance());
+ }
+
+ @Test
+ public void testNonBlockableAppDoesNotBecomeMin() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null,
+ null, Collections.singleton(TEST_PACKAGE_NAME));
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ waitForUndoButton();
+ verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
+ anyString(), eq(TEST_UID), any());
+ }
+
+ @Test
+ public void testMinChangedCallsUpdateNotificationChannel() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mSbn.getNotification().flags = Notification.FLAG_FOREGROUND_SERVICE;
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
+
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ waitForUndoButton();
+ mNotificationInfo.handleCloseControls(true, false);
+
+ ArgumentCaptor<NotificationChannel> updated =
+ ArgumentCaptor.forClass(NotificationChannel.class);
+ verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage(
+ anyString(), eq(TEST_UID), updated.capture());
+ assertTrue((updated.getValue().getUserLockedFields()
+ & USER_LOCKED_IMPORTANCE) != 0);
+ assertEquals(IMPORTANCE_MIN, updated.getValue().getImportance());
}
@Test
@@ -416,6 +485,40 @@
}
@Test
+ public void testMinUndoDoesNotMinNotificationChannel() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null);
+
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ waitForUndoButton();
+ mNotificationInfo.findViewById(R.id.undo).performClick();
+ waitForStopButton();
+ mNotificationInfo.handleCloseControls(true, false);
+
+ ArgumentCaptor<NotificationChannel> updated =
+ ArgumentCaptor.forClass(NotificationChannel.class);
+ verify(mMockINotificationManager, times(1)).updateNotificationChannelForPackage(
+ anyString(), eq(TEST_UID), updated.capture());
+ assertTrue(0 != (mNotificationChannel.getUserLockedFields() & USER_LOCKED_IMPORTANCE));
+ assertEquals(IMPORTANCE_LOW, mNotificationChannel.getImportance());
+ }
+
+ @Test
+ public void testCloseControlsDoesNotUpdateiMinIfSaveIsFalse() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null,
+ Collections.singleton(TEST_PACKAGE_NAME));
+
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ waitForUndoButton();
+ mNotificationInfo.handleCloseControls(false, false);
+ verify(mMockINotificationManager, never()).updateNotificationChannelForPackage(
+ eq(TEST_PACKAGE_NAME), eq(TEST_UID), eq(mNotificationChannel));
+ }
+
+ @Test
public void testCloseControlsDoesNotUpdateIfSaveIsFalse() throws Exception {
mNotificationChannel.setImportance(IMPORTANCE_LOW);
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
@@ -557,4 +660,57 @@
public void testWillBeRemovedReturnsFalseBeforeBind() throws Exception {
assertFalse(mNotificationInfo.willBeRemoved());
}
+
+ @Test
+ public void testUndoText_min() throws Exception {
+ mSbn.getNotification().flags = Notification.FLAG_FOREGROUND_SERVICE;
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null,
+ Collections.singleton(TEST_PACKAGE_NAME));
+
+ mNotificationInfo.findViewById(R.id.minimize).performClick();
+ waitForUndoButton();
+ TextView confirmationText = mNotificationInfo.findViewById(R.id.confirmation_text);
+ assertTrue(confirmationText.getText().toString().contains("minimized"));
+ }
+
+ @Test
+ public void testUndoText_block() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null,
+ Collections.singleton(TEST_PACKAGE_NAME));
+
+ mNotificationInfo.findViewById(R.id.block).performClick();
+ waitForUndoButton();
+ TextView confirmationText = mNotificationInfo.findViewById(R.id.confirmation_text);
+ assertTrue(confirmationText.getText().toString().contains("won't see"));
+ }
+
+ @Test
+ public void testNoHeaderOnConfirmation() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null,
+ Collections.singleton(TEST_PACKAGE_NAME));
+
+ mNotificationInfo.findViewById(R.id.block).performClick();
+ waitForUndoButton();
+ assertEquals(GONE, mNotificationInfo.findViewById(R.id.header).getVisibility());
+ }
+
+ @Test
+ public void testHeaderOnUndo() throws Exception {
+ mNotificationChannel.setImportance(IMPORTANCE_LOW);
+ mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
+ TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null,
+ Collections.singleton(TEST_PACKAGE_NAME));
+
+ mNotificationInfo.findViewById(R.id.block).performClick();
+ waitForUndoButton();
+ mNotificationInfo.findViewById(R.id.undo).performClick();
+ waitForStopButton();
+ assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility());
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index ff545f0..14baaeb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -346,7 +346,7 @@
public void testShouldPeek_nonSuppressedGroupSummary() {
when(mPowerManager.isScreenOn()).thenReturn(true);
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
+ when(mNotificationData.shouldSuppressStatusBar(any())).thenReturn(false);
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
@@ -367,7 +367,7 @@
public void testShouldPeek_suppressedGroupSummary() {
when(mPowerManager.isScreenOn()).thenReturn(true);
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
+ when(mNotificationData.shouldSuppressStatusBar(any())).thenReturn(false);
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
@@ -385,16 +385,32 @@
}
@Test
- public void testShouldPeek_suppressedScreenOn_dozing() {
+ public void testShouldPeek_suppressedPeek() {
when(mPowerManager.isScreenOn()).thenReturn(true);
when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
when(mSystemServicesProxy.isDreaming()).thenReturn(false);
when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
- mStatusBar.mDozing = true;
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true);
- when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false);
+ when(mNotificationData.shouldSuppressPeek(any())).thenReturn(true);
+
+ Notification n = new Notification.Builder(getContext(), "a").build();
+ StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
+ UserHandle.of(0), null, 0);
+ NotificationData.Entry entry = new NotificationData.Entry(sbn);
+
+ assertFalse(mEntryManager.shouldPeek(entry, sbn));
+ }
+
+ @Test
+ public void testShouldPeek_noSuppressedPeek() {
+ when(mPowerManager.isScreenOn()).thenReturn(true);
+ when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
+ when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
+ when(mSystemServicesProxy.isDreaming()).thenReturn(false);
+ when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
+
+ when(mNotificationData.shouldSuppressPeek(any())).thenReturn(false);
Notification n = new Notification.Builder(getContext(), "a").build();
StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
@@ -405,63 +421,6 @@
}
@Test
- public void testShouldPeek_suppressedScreenOn_noDoze() {
- when(mPowerManager.isScreenOn()).thenReturn(true);
- when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
- when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
- when(mSystemServicesProxy.isDreaming()).thenReturn(false);
- when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
-
- mStatusBar.mDozing = false;
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true);
- when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false);
-
- Notification n = new Notification.Builder(getContext(), "a").build();
- StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
- UserHandle.of(0), null, 0);
- NotificationData.Entry entry = new NotificationData.Entry(sbn);
- assertFalse(mEntryManager.shouldPeek(entry, sbn));
- }
- @Test
- public void testShouldPeek_suppressedScreenOff_dozing() {
- when(mPowerManager.isScreenOn()).thenReturn(true);
- when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
- when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
- when(mSystemServicesProxy.isDreaming()).thenReturn(false);
- when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
-
- mStatusBar.mDozing = true;
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
- when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true);
-
- Notification n = new Notification.Builder(getContext(), "a").build();
- StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
- UserHandle.of(0), null, 0);
- NotificationData.Entry entry = new NotificationData.Entry(sbn);
- assertFalse(mEntryManager.shouldPeek(entry, sbn));
- }
-
- @Test
- public void testShouldPeek_suppressedScreenOff_noDoze() {
- when(mPowerManager.isScreenOn()).thenReturn(true);
- when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false);
- when(mNotificationData.shouldFilterOut(any())).thenReturn(false);
- when(mSystemServicesProxy.isDreaming()).thenReturn(false);
- when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH);
-
- mStatusBar.mDozing = false;
- when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false);
- when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true);
-
- Notification n = new Notification.Builder(getContext(), "a").build();
- StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
- UserHandle.of(0), null, 0);
- NotificationData.Entry entry = new NotificationData.Entry(sbn);
- assertTrue(mEntryManager.shouldPeek(entry, sbn));
- }
-
-
- @Test
public void testLogHidden() {
try {
mStatusBar.handleVisibleToUserChanged(false);
@@ -574,6 +533,7 @@
public void testFingerprintNotification_UpdatesScrims() {
mStatusBar.mStatusBarWindowManager = mock(StatusBarWindowManager.class);
mStatusBar.mDozeScrimController = mock(DozeScrimController.class);
+ mStatusBar.mNotificationIconAreaController = mock(NotificationIconAreaController.class);
mStatusBar.notifyFpAuthModeChanged();
verify(mScrimController).transitionTo(any(), any());
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
index e3558d4..2afb48c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/CallbackHandlerTest.java
@@ -111,8 +111,8 @@
boolean out = true;
String typeDescription = "Test 1";
String description = "Test 2";
- int type = R.drawable.stat_sys_data_fully_connected_1x;
- int qsType = R.drawable.ic_qs_signal_1x;
+ int type = TelephonyIcons.ICON_1X;
+ int qsType = TelephonyIcons.ICON_1X;
boolean wide = true;
int subId = 5;
boolean roaming = true;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 27cd9a0..714ad1f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -70,7 +70,7 @@
protected static final int DEFAULT_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_QS_SIGNAL_STRENGTH = DEFAULT_LEVEL;
protected static final int DEFAULT_ICON = TelephonyIcons.ICON_3G;
- protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_DATA_3G;
+ protected static final int DEFAULT_QS_ICON = TelephonyIcons.ICON_3G;
protected NetworkControllerImpl mNetworkController;
protected MobileSignalController mMobileSignalController;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index cf3620d..8629799 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -6,7 +6,6 @@
import android.net.NetworkCapabilities;
import android.os.Looper;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.TelephonyManager;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
@@ -15,7 +14,6 @@
import com.android.settingslib.net.DataUsageController;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -28,8 +26,7 @@
public void test3gDataIcon() {
setupDefaultSignal();
- verifyDataIndicators(TelephonyIcons.ICON_3G,
- TelephonyIcons.QS_DATA_3G);
+ verifyDataIndicators(TelephonyIcons.ICON_3G);
}
@Test
@@ -38,8 +35,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_GSM);
- verifyDataIndicators(TelephonyIcons.ICON_G,
- TelephonyIcons.QS_DATA_G);
+ verifyDataIndicators(TelephonyIcons.ICON_G);
}
@Test
@@ -48,8 +44,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_CDMA);
- verifyDataIndicators(TelephonyIcons.ICON_1X,
- TelephonyIcons.QS_DATA_1X);
+ verifyDataIndicators(TelephonyIcons.ICON_1X);
}
@Test
@@ -58,8 +53,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_EDGE);
- verifyDataIndicators(TelephonyIcons.ICON_E,
- TelephonyIcons.QS_DATA_E);
+ verifyDataIndicators(TelephonyIcons.ICON_E);
}
@Test
@@ -68,8 +62,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
- verifyDataIndicators(TelephonyIcons.ICON_LTE,
- TelephonyIcons.QS_DATA_LTE);
+ verifyDataIndicators(TelephonyIcons.ICON_LTE);
}
@Test
@@ -78,8 +71,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_HSPA);
- verifyDataIndicators(TelephonyIcons.ICON_H,
- TelephonyIcons.QS_DATA_H);
+ verifyDataIndicators(TelephonyIcons.ICON_H);
}
@Test
@@ -88,7 +80,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_IWLAN);
- verifyDataIndicators(0, 0);
+ verifyDataIndicators(0);
}
@Test
@@ -106,8 +98,7 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
- verifyDataIndicators(TelephonyIcons.ICON_4G,
- TelephonyIcons.QS_DATA_4G);
+ verifyDataIndicators(TelephonyIcons.ICON_4G);
}
@Test
@@ -150,7 +141,7 @@
TestableLooper.get(this).processAllMessages();
// Don't show the X until the device is setup.
- verifyDataIndicators(0, 0);
+ verifyDataIndicators(0);
}
@Test
@@ -165,8 +156,7 @@
mConfig.alwaysShowDataRatIcon = true;
mNetworkController.handleConfigurationChanged();
- verifyDataIndicators(TelephonyIcons.ICON_G,
- TelephonyIcons.QS_DATA_G);
+ verifyDataIndicators(TelephonyIcons.ICON_G);
}
@Test
@@ -182,8 +172,7 @@
// the after work.
mNetworkController.handleConfigurationChanged();
- verifyDataIndicators(TelephonyIcons.ICON_4G,
- TelephonyIcons.QS_DATA_4G);
+ verifyDataIndicators(TelephonyIcons.ICON_4G);
}
@Test
@@ -192,14 +181,12 @@
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_LTE);
- verifyDataIndicators(TelephonyIcons.ICON_LTE,
- TelephonyIcons.QS_DATA_LTE);
+ verifyDataIndicators(TelephonyIcons.ICON_LTE);
when(mServiceState.getDataNetworkType())
.thenReturn(TelephonyManager.NETWORK_TYPE_HSPA);
updateServiceState();
- verifyDataIndicators(TelephonyIcons.ICON_H,
- TelephonyIcons.QS_DATA_H);
+ verifyDataIndicators(TelephonyIcons.ICON_H);
}
@Test
@@ -219,9 +206,9 @@
DEFAULT_QS_SIGNAL_STRENGTH, DEFAULT_QS_ICON, in, out);
}
- private void verifyDataIndicators(int dataIcon, int qsDataIcon) {
+ private void verifyDataIndicators(int dataIcon) {
verifyLastMobileDataIndicators(true, DEFAULT_SIGNAL_STRENGTH, dataIcon,
- true, DEFAULT_QS_SIGNAL_STRENGTH, qsDataIcon, false,
+ true, DEFAULT_QS_SIGNAL_STRENGTH, dataIcon, false,
false);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 550f4a7..33aa417 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -223,7 +223,7 @@
verifyLastQsMobileDataIndicators(true,
testStrength,
- TelephonyIcons.QS_DATA_1X, false, false);
+ TelephonyIcons.ICON_1X, false, false);
}
}
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index e962c0b..e9b1023 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -5453,6 +5453,38 @@
// OS: P
ACTION_OPS_GUTS_SETTINGS = 1346;
+ // ACTION: Settings > Battery settings > Battery tip > App restriction tip
+ // OS: P
+ ACTION_APP_RESTRICTION_TIP = 1347;
+
+ // ACTION: Settings > Battery settings > Battery tip > High usage tip
+ // OS: P
+ ACTION_HIGH_USAGE_TIP = 1348;
+
+ // ACTION: Settings > Battery settings > Battery tip > Summary tip
+ // OS: P
+ ACTION_SUMMARY_TIP = 1349;
+
+ // ACTION: Settings > Battery settings > Battery tip > Smart battery tip
+ // OS: P
+ ACTION_SMART_BATTERY_TIP = 1350;
+
+ // ACTION: Settings > Battery settings > Battery tip > Early warning tip
+ // OS: P
+ ACTION_EARLY_WARNING_TIP = 1351;
+
+ // ACTION: Settings > Battery settings > Battery tip > Low battery tip
+ // OS: P
+ ACTION_LOW_BATTERY_TIP = 1352;
+
+ // ACTION: Settings > Battery settings > Battery tip > App restriction list shown
+ // OS: P
+ ACTION_APP_RESTRICTION_TIP_LIST = 1353;
+
+ // ACTION: Settings > Battery settings > Battery tip > High usage list shown
+ // OS: P
+ ACTION_HIGH_USAGE_TIP_LIST = 1354;
+
// ---- End P Constants, all P constants go above this line ----
// Add new aosp constants above this line.
// END OF AOSP CONSTANTS
diff --git a/services/core/java/com/android/server/AppStateTracker.java b/services/core/java/com/android/server/AppStateTracker.java
index a6b71b7..16be680 100644
--- a/services/core/java/com/android/server/AppStateTracker.java
+++ b/services/core/java/com/android/server/AppStateTracker.java
@@ -258,7 +258,7 @@
*/
private void onRunAnyAppOpsChanged(AppStateTracker sender,
int uid, @NonNull String packageName) {
- updateJobsForUidPackage(uid, packageName);
+ updateJobsForUidPackage(uid, packageName, sender.isUidActive(uid));
if (!sender.areAlarmsRestricted(uid, packageName, /*allowWhileIdle=*/ false)) {
unblockAlarmsForUidPackage(uid, packageName);
@@ -279,9 +279,11 @@
* This is called when the active/idle state changed for a UID.
*/
private void onUidActiveStateChanged(AppStateTracker sender, int uid) {
- updateJobsForUid(uid);
+ final boolean isActive = sender.isUidActive(uid);
- if (sender.isUidActive(uid)) {
+ updateJobsForUid(uid, isActive);
+
+ if (isActive) {
unblockAlarmsForUid(uid);
}
}
@@ -346,14 +348,14 @@
* Called when the job restrictions for a UID might have changed, so the job
* scheduler should re-evaluate all restrictions for all jobs.
*/
- public void updateJobsForUid(int uid) {
+ public void updateJobsForUid(int uid, boolean isNowActive) {
}
/**
* Called when the job restrictions for a UID - package might have changed, so the job
* scheduler should re-evaluate all restrictions for all jobs.
*/
- public void updateJobsForUidPackage(int uid, String packageName) {
+ public void updateJobsForUidPackage(int uid, String packageName, boolean isNowActive) {
}
/**
diff --git a/services/core/java/com/android/server/EventLogTags.logtags b/services/core/java/com/android/server/EventLogTags.logtags
index 0502117..45c9a71 100644
--- a/services/core/java/com/android/server/EventLogTags.logtags
+++ b/services/core/java/com/android/server/EventLogTags.logtags
@@ -35,6 +35,8 @@
# Power save state has changed. See BatterySaverController.java for the details.
2739 battery_saver_mode (prevOffOrOn|1|5),(nowOffOrOn|1|5),(interactive|1|5),(features|3|5)
27390 battery_saving_stats (batterySaver|1|5),(interactive|1|5),(doze|1|5),(delta_duration|2|3),(delta_battery_drain|1|1),(delta_battery_drain_percent|1|6),(total_duration|2|3),(total_battery_drain|1|1),(total_battery_drain_percent|1|6)
+# Note when the user activity timeout has been overriden by ActivityManagerService
+27391 user_activity_timeout_override (override|2|3)
#
# Leave IDs through 2740 for more power logs (2730 used by battery_discharge above)
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 55512f4..c1c68e8 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5150,6 +5150,7 @@
public void startRecentsActivity(Intent intent, IAssistDataReceiver assistDataReceiver,
IRecentsAnimationRunner recentsAnimationRunner) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS, "startRecentsActivity()");
+ final int callingPid = Binder.getCallingPid();
final long origId = Binder.clearCallingIdentity();
try {
final int recentsUid;
@@ -5163,7 +5164,7 @@
// Start a new recents animation
final RecentsAnimation anim = new RecentsAnimation(this, mStackSupervisor,
- mActivityStartController, mWindowManager, mUserController);
+ mActivityStartController, mWindowManager, mUserController, callingPid);
anim.startRecentsActivity(intent, recentsAnimationRunner, recentsComponent,
recentsUid);
}
@@ -14341,6 +14342,28 @@
}
}
+ void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
+ synchronized (ActivityManagerService.this) {
+ final ProcessRecord pr;
+ synchronized (mPidsSelfLocked) {
+ pr = mPidsSelfLocked.get(pid);
+ if (pr == null) {
+ Slog.w(TAG, "setRunningRemoteAnimation called on unknown pid: " + pid);
+ return;
+ }
+ }
+ if (pr.runningRemoteAnimation == runningRemoteAnimation) {
+ return;
+ }
+ pr.runningRemoteAnimation = runningRemoteAnimation;
+ if (DEBUG_OOM_ADJ) {
+ Slog.i(TAG, "Setting runningRemoteAnimation=" + pr.runningRemoteAnimation
+ + " for pid=" + pid);
+ }
+ updateOomAdjLocked(pr, true);
+ }
+ }
+
public final void enterSafeMode() {
synchronized(this) {
// It only makes sense to do this before the system is ready
@@ -22751,6 +22774,12 @@
foregroundActivities = true;
procState = PROCESS_STATE_CUR_TOP;
if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making top: " + app);
+ } else if (app.runningRemoteAnimation) {
+ adj = ProcessList.VISIBLE_APP_ADJ;
+ schedGroup = ProcessList.SCHED_GROUP_TOP_APP;
+ app.adjType = "running-remote-anim";
+ procState = PROCESS_STATE_CUR_TOP;
+ if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Making running remote anim: " + app);
} else if (app.instr != null) {
// Don't want to kill running instrumentation.
adj = ProcessList.FOREGROUND_APP_ADJ;
@@ -22826,7 +22855,9 @@
app.adjType = "vis-activity";
if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to vis-activity: " + app);
}
- schedGroup = ProcessList.SCHED_GROUP_DEFAULT;
+ if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) {
+ schedGroup = ProcessList.SCHED_GROUP_DEFAULT;
+ }
app.cached = false;
app.empty = false;
foregroundActivities = true;
@@ -22849,7 +22880,9 @@
app.adjType = "pause-activity";
if (DEBUG_OOM_ADJ_REASON) Slog.d(TAG, "Raise to pause-activity: " + app);
}
- schedGroup = ProcessList.SCHED_GROUP_DEFAULT;
+ if (schedGroup < ProcessList.SCHED_GROUP_DEFAULT) {
+ schedGroup = ProcessList.SCHED_GROUP_DEFAULT;
+ }
app.cached = false;
app.empty = false;
foregroundActivities = true;
@@ -25990,6 +26023,11 @@
}
}
+ @Override
+ public void setRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
+ ActivityManagerService.this.setRunningRemoteAnimation(pid, runningRemoteAnimation);
+ }
+
/**
* Called after the network policy rules are updated by
* {@link com.android.server.net.NetworkPolicyManagerService} for a specific {@param uid}
@@ -26539,6 +26577,7 @@
throws RemoteException {
enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS,
"registerRemoteAnimations");
+ definition.setCallingPid(Binder.getCallingPid());
synchronized (this) {
final ActivityRecord r = ActivityRecord.isInStackLocked(token);
if (r == null) {
@@ -26558,6 +26597,7 @@
RemoteAnimationAdapter adapter) throws RemoteException {
enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS,
"registerRemoteAnimationForNextActivityStart");
+ adapter.setCallingPid(Binder.getCallingPid());
synchronized (this) {
final long origId = Binder.clearCallingIdentity();
try {
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 7749bd7..5ee3d2f 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2284,22 +2284,22 @@
// Protect against recursion.
mStackSupervisor.inResumeTopActivity = true;
result = resumeTopActivityInnerLocked(prev, options);
+
+ // When resuming the top activity, it may be necessary to pause the top activity (for
+ // example, returning to the lock screen. We suppress the normal pause logic in
+ // {@link #resumeTopActivityUncheckedLocked}, since the top activity is resumed at the
+ // end. We call the {@link ActivityStackSupervisor#checkReadyForSleepLocked} again here
+ // to ensure any necessary pause logic occurs. In the case where the Activity will be
+ // shown regardless of the lock screen, the call to
+ // {@link ActivityStackSupervisor#checkReadyForSleepLocked} is skipped.
+ final ActivityRecord next = topRunningActivityLocked(true /* focusableOnly */);
+ if (next == null || !next.canTurnScreenOn()) {
+ checkReadyForSleep();
+ }
} finally {
mStackSupervisor.inResumeTopActivity = false;
}
- // When resuming the top activity, it may be necessary to pause the top activity (for
- // example, returning to the lock screen. We suppress the normal pause logic in
- // {@link #resumeTopActivityUncheckedLocked}, since the top activity is resumed at the end.
- // We call the {@link ActivityStackSupervisor#checkReadyForSleepLocked} again here to ensure
- // any necessary pause logic occurs. In the case where the Activity will be shown regardless
- // of the lock screen, the call to {@link ActivityStackSupervisor#checkReadyForSleepLocked}
- // is skipped.
- final ActivityRecord next = topRunningActivityLocked(true /* focusableOnly */);
- if (next == null || !next.canTurnScreenOn()) {
- checkReadyForSleep();
- }
-
return result;
}
@@ -2854,7 +2854,7 @@
true /* includingParents */);
}
- final void startActivityLocked(ActivityRecord r, ActivityRecord focusedTopActivity,
+ void startActivityLocked(ActivityRecord r, ActivityRecord focusedTopActivity,
boolean newTask, boolean keepCurTransition, ActivityOptions options) {
TaskRecord rTask = r.getTask();
final int taskId = rTask.taskId;
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 1f60755..0bf2691 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -129,6 +129,12 @@
// When true the process will oom adj score will be set to
// ProcessList#PERCEPTIBLE_APP_ADJ at minimum to reduce the chance
// of the process getting killed.
+ boolean runningRemoteAnimation; // Is the process currently running a RemoteAnimation? When true
+ // the process will be set to use the
+ // ProcessList#SCHED_GROUP_TOP_APP scheduling group to boost
+ // performance, as well as oom adj score will be set to
+ // ProcessList#VISIBLE_APP_ADJ at minimum to reduce the chance
+ // of the process getting killed.
boolean pendingUiClean; // Want to clean up resources from showing UI?
boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower
boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY
@@ -336,9 +342,10 @@
pw.print(" hasAboveClient="); pw.print(hasAboveClient);
pw.print(" treatLikeActivity="); pw.println(treatLikeActivity);
}
- if (hasTopUi || hasOverlayUi) {
+ if (hasTopUi || hasOverlayUi || runningRemoteAnimation) {
pw.print(prefix); pw.print("hasTopUi="); pw.print(hasTopUi);
- pw.print(" hasOverlayUi="); pw.println(hasOverlayUi);
+ pw.print(" hasOverlayUi="); pw.print(hasOverlayUi);
+ pw.print(" runningRemoteAnimation="); pw.println(runningRemoteAnimation);
}
if (foregroundServices || forcingToImportant != null) {
pw.print(prefix); pw.print("foregroundServices="); pw.print(foregroundServices);
diff --git a/services/core/java/com/android/server/am/RecentsAnimation.java b/services/core/java/com/android/server/am/RecentsAnimation.java
index 4b1594c..322d66b 100644
--- a/services/core/java/com/android/server/am/RecentsAnimation.java
+++ b/services/core/java/com/android/server/am/RecentsAnimation.java
@@ -50,6 +50,7 @@
private final WindowManagerService mWindowManager;
private final UserController mUserController;
private final Handler mHandler;
+ private final int mCallingPid;
private final Runnable mCancelAnimationRunnable;
@@ -58,13 +59,14 @@
RecentsAnimation(ActivityManagerService am, ActivityStackSupervisor stackSupervisor,
ActivityStartController activityStartController, WindowManagerService wm,
- UserController userController) {
+ UserController userController, int callingPid) {
mService = am;
mStackSupervisor = stackSupervisor;
mActivityStartController = activityStartController;
mHandler = new Handler(mStackSupervisor.mLooper);
mWindowManager = wm;
mUserController = userController;
+ mCallingPid = callingPid;
mCancelAnimationRunnable = () -> {
// The caller has not finished the animation in a predefined amount of time, so
@@ -94,9 +96,10 @@
}
}
+ mService.setRunningRemoteAnimation(mCallingPid, true);
+
mWindowManager.deferSurfaceLayout();
try {
-
final ActivityDisplay display;
if (hasExistingHomeActivity) {
// Move the home activity into place for the animation if it is not already top most
@@ -153,6 +156,8 @@
synchronized (mService) {
if (mWindowManager.getRecentsAnimationController() == null) return;
+ mService.setRunningRemoteAnimation(mCallingPid, false);
+
mWindowManager.inSurfaceTransaction(() -> {
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER,
"RecentsAnimation#onAnimationFinished_inSurfaceTransaction");
diff --git a/services/core/java/com/android/server/am/SafeActivityOptions.java b/services/core/java/com/android/server/am/SafeActivityOptions.java
index d08111e..ac6f01f 100644
--- a/services/core/java/com/android/server/am/SafeActivityOptions.java
+++ b/services/core/java/com/android/server/am/SafeActivityOptions.java
@@ -121,10 +121,16 @@
if (mOriginalOptions != null) {
checkPermissions(intent, aInfo, callerApp, supervisor, mOriginalOptions,
mOriginalCallingPid, mOriginalCallingUid);
+ if (mOriginalOptions.getRemoteAnimationAdapter() != null) {
+ mOriginalOptions.getRemoteAnimationAdapter().setCallingPid(mOriginalCallingPid);
+ }
}
if (mCallerOptions != null) {
checkPermissions(intent, aInfo, callerApp, supervisor, mCallerOptions,
mRealCallingPid, mRealCallingUid);
+ if (mCallerOptions.getRemoteAnimationAdapter() != null) {
+ mCallerOptions.getRemoteAnimationAdapter().setCallingPid(mRealCallingPid);
+ }
}
return mergeActivityOptions(mOriginalOptions, mCallerOptions);
}
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
index 406231a..954c001 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/BroadcastRadioService.java
@@ -101,7 +101,9 @@
}
TunerSession session = module.openSession(callback);
- session.setConfiguration(legacyConfig);
+ if (legacyConfig != null) {
+ session.setConfiguration(legacyConfig);
+ }
return session;
}
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
index daec97a..816ba0b 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/RadioModule.java
@@ -55,7 +55,7 @@
public static @Nullable RadioModule tryLoadingModule(int idx, @NonNull String fqName) {
try {
- IBroadcastRadio service = IBroadcastRadio.getService();
+ IBroadcastRadio service = IBroadcastRadio.getService(fqName);
if (service == null) return null;
Mutable<AmFmRegionConfig> amfmConfig = new Mutable<>();
diff --git a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java
index 8efaa2a..8f3f099 100644
--- a/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java
+++ b/services/core/java/com/android/server/broadcastradio/hal2/TunerSession.java
@@ -90,7 +90,8 @@
if (ret == AudioSystem.AUDIO_STATUS_OK) {
mIsAudioConnected = connected;
} else {
- Slog.e(TAG, "Failed to notify AudioService about new state: " + connected);
+ Slog.e(TAG, "Failed to notify AudioService about new state: "
+ + connected + ", response was: " + ret);
}
}
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
index 0e7e540..790d396 100644
--- a/services/core/java/com/android/server/job/JobSchedulerService.java
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -88,7 +88,6 @@
import com.android.server.job.JobSchedulerServiceDumpProto.ActiveJob;
import com.android.server.job.JobSchedulerServiceDumpProto.PendingJob;
import com.android.server.job.JobSchedulerServiceDumpProto.RegisteredJob;
-import com.android.server.job.controllers.AppIdleController;
import com.android.server.job.controllers.BackgroundJobsController;
import com.android.server.job.controllers.BatteryController;
import com.android.server.job.controllers.ConnectivityController;
@@ -1051,7 +1050,8 @@
final JobStatus job = jsc.getRunningJobLocked();
if (job != null
&& (job.getJob().getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) == 0
- && !job.dozeWhitelisted) {
+ && !job.dozeWhitelisted
+ && !job.uidActive) {
// We will report active if we have a job running and it is not an exception
// due to being in the foreground or whitelisted.
active = true;
@@ -1115,7 +1115,6 @@
mStorageController = new StorageController(this);
mControllers.add(mStorageController);
mControllers.add(new BackgroundJobsController(this));
- mControllers.add(new AppIdleController(this));
mControllers.add(new ContentObserverController(this));
mDeviceIdleJobsController = new DeviceIdleJobsController(this);
mControllers.add(mDeviceIdleJobsController);
@@ -1867,6 +1866,9 @@
// scheduled are sitting there, not ready yet) and very cheap to check (just
// a few conditions on data in JobStatus).
if (!jobReady) {
+ if (job.getSourcePackageName().equals("android.jobscheduler.cts.jobtestapp")) {
+ Slog.v(TAG, " NOT READY: " + job);
+ }
return false;
}
@@ -1905,9 +1907,21 @@
// an appropriate amount of time since the last invocation. During device-
// wide parole, standby bucketing is ignored.
//
- // But if a job has FLAG_EXEMPT_FROM_APP_STANDBY, don't check it.
- if (!mInParole && !job.getJob().isExemptedFromAppStandby()) {
+ // Jobs in 'active' apps are not subject to standby, nor are jobs that are
+ // specifically marked as exempt.
+ if (DEBUG_STANDBY) {
+ Slog.v(TAG, "isReadyToBeExecutedLocked: " + job.toShortString()
+ + " parole=" + mInParole + " active=" + job.uidActive
+ + " exempt=" + job.getJob().isExemptedFromAppStandby());
+ }
+ if (!mInParole
+ && !job.uidActive
+ && !job.getJob().isExemptedFromAppStandby()) {
final int bucket = job.getStandbyBucket();
+ if (DEBUG_STANDBY) {
+ Slog.v(TAG, " bucket=" + bucket + " heartbeat=" + mHeartbeat
+ + " next=" + mNextBucketHeartbeat[bucket]);
+ }
if (mHeartbeat < mNextBucketHeartbeat[bucket]) {
// Only skip this job if the app is still waiting for the end of its nominal
// bucket interval. Once it's waited that long, we let it go ahead and clear.
diff --git a/services/core/java/com/android/server/job/controllers/AppIdleController.java b/services/core/java/com/android/server/job/controllers/AppIdleController.java
deleted file mode 100644
index ed29a4c..0000000
--- a/services/core/java/com/android/server/job/controllers/AppIdleController.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.server.job.controllers;
-
-import android.app.usage.UsageStatsManagerInternal;
-import android.os.UserHandle;
-import android.util.Log;
-import android.util.Slog;
-import android.util.proto.ProtoOutputStream;
-
-import com.android.internal.util.IndentingPrintWriter;
-import com.android.server.LocalServices;
-import com.android.server.job.JobSchedulerService;
-import com.android.server.job.StateControllerProto;
-
-import java.util.function.Consumer;
-import java.util.function.Predicate;
-
-/**
- * Controls when apps are considered idle and if jobs pertaining to those apps should
- * be executed. Apps that haven't been actively launched or accessed from a foreground app
- * for a certain amount of time (maybe hours or days) are considered idle. When the app comes
- * out of idle state, it will be allowed to run scheduled jobs.
- */
-public final class AppIdleController extends StateController {
- private static final String TAG = "JobScheduler.AppIdle";
- private static final boolean DEBUG = JobSchedulerService.DEBUG
- || Log.isLoggable(TAG, Log.DEBUG);
-
- private final UsageStatsManagerInternal mUsageStatsInternal;
- private boolean mInitializedParoleOn;
- boolean mAppIdleParoleOn;
-
- final class GlobalUpdateFunc implements Consumer<JobStatus> {
- boolean mChanged;
-
- @Override
- public void accept(JobStatus jobStatus) {
- String packageName = jobStatus.getSourcePackageName();
- final boolean appIdle = !mAppIdleParoleOn && mUsageStatsInternal.isAppIdle(packageName,
- jobStatus.getSourceUid(), jobStatus.getSourceUserId());
- if (DEBUG) {
- Slog.d(TAG, "Setting idle state of " + packageName + " to " + appIdle);
- }
- if (jobStatus.setAppNotIdleConstraintSatisfied(!appIdle)) {
- mChanged = true;
- }
- }
- }
-
- final static class PackageUpdateFunc implements Consumer<JobStatus> {
- final int mUserId;
- final String mPackage;
- final boolean mIdle;
- boolean mChanged;
-
- PackageUpdateFunc(int userId, String pkg, boolean idle) {
- mUserId = userId;
- mPackage = pkg;
- mIdle = idle;
- }
-
- @Override
- public void accept(JobStatus jobStatus) {
- if (jobStatus.getSourcePackageName().equals(mPackage)
- && jobStatus.getSourceUserId() == mUserId) {
- if (jobStatus.setAppNotIdleConstraintSatisfied(!mIdle)) {
- if (DEBUG) {
- Slog.d(TAG, "App Idle state changed, setting idle state of "
- + mPackage + " to " + mIdle);
- }
- mChanged = true;
- }
- }
- }
- }
-
- public AppIdleController(JobSchedulerService service) {
- super(service);
- mUsageStatsInternal = LocalServices.getService(UsageStatsManagerInternal.class);
- mAppIdleParoleOn = true;
- mUsageStatsInternal.addAppIdleStateChangeListener(new AppIdleStateChangeListener());
- }
-
- @Override
- public void maybeStartTrackingJobLocked(JobStatus jobStatus, JobStatus lastJob) {
- if (!mInitializedParoleOn) {
- mInitializedParoleOn = true;
- mAppIdleParoleOn = mUsageStatsInternal.isAppIdleParoleOn();
- }
- String packageName = jobStatus.getSourcePackageName();
- final boolean appIdle = !mAppIdleParoleOn && mUsageStatsInternal.isAppIdle(packageName,
- jobStatus.getSourceUid(), jobStatus.getSourceUserId());
- if (DEBUG) {
- Slog.d(TAG, "Start tracking, setting idle state of "
- + packageName + " to " + appIdle);
- }
- jobStatus.setAppNotIdleConstraintSatisfied(!appIdle);
- }
-
- @Override
- public void maybeStopTrackingJobLocked(JobStatus jobStatus, JobStatus incomingJob,
- boolean forUpdate) {
- }
-
- @Override
- public void dumpControllerStateLocked(final IndentingPrintWriter pw,
- final Predicate<JobStatus> predicate) {
- pw.println("Parole on: " + mAppIdleParoleOn);
- pw.println();
-
- mService.getJobStore().forEachJob(predicate, (jobStatus) -> {
- pw.print("#");
- jobStatus.printUniqueId(pw);
- pw.print(" from ");
- UserHandle.formatUid(pw, jobStatus.getSourceUid());
- pw.print(": ");
- pw.print(jobStatus.getSourcePackageName());
- if ((jobStatus.satisfiedConstraints&JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0) {
- pw.println(" RUNNABLE");
- } else {
- pw.println(" WAITING");
- }
- });
- }
-
- @Override
- public void dumpControllerStateLocked(ProtoOutputStream proto, long fieldId,
- Predicate<JobStatus> predicate) {
- final long token = proto.start(fieldId);
- final long mToken = proto.start(StateControllerProto.APP_IDLE);
-
- proto.write(StateControllerProto.AppIdleController.IS_PAROLE_ON, mAppIdleParoleOn);
-
- mService.getJobStore().forEachJob(predicate, (js) -> {
- final long jsToken =
- proto.start(StateControllerProto.AppIdleController.TRACKED_JOBS);
- js.writeToShortProto(proto, StateControllerProto.AppIdleController.TrackedJob.INFO);
- proto.write(StateControllerProto.AppIdleController.TrackedJob.SOURCE_UID,
- js.getSourceUid());
- proto.write(StateControllerProto.AppIdleController.TrackedJob.SOURCE_PACKAGE_NAME,
- js.getSourcePackageName());
- proto.write(
- StateControllerProto.AppIdleController.TrackedJob.ARE_CONSTRAINTS_SATISFIED,
- (js.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
- proto.end(jsToken);
- });
-
- proto.end(mToken);
- proto.end(token);
- }
-
- void setAppIdleParoleOn(boolean isAppIdleParoleOn) {
- // Flag if any app's idle state has changed
- boolean changed = false;
- synchronized (mLock) {
- if (mAppIdleParoleOn == isAppIdleParoleOn) {
- return;
- }
- mAppIdleParoleOn = isAppIdleParoleOn;
- GlobalUpdateFunc update = new GlobalUpdateFunc();
- mService.getJobStore().forEachJob(update);
- if (update.mChanged) {
- changed = true;
- }
- }
- if (changed) {
- mStateChangedListener.onControllerStateChanged();
- }
- }
-
- private final class AppIdleStateChangeListener
- extends UsageStatsManagerInternal.AppIdleStateChangeListener {
- @Override
- public void onAppIdleStateChanged(String packageName, int userId, boolean idle, int bucket,
- int reason) {
- boolean changed = false;
- synchronized (mLock) {
- if (mAppIdleParoleOn) {
- return;
- }
-
- PackageUpdateFunc update = new PackageUpdateFunc(userId, packageName, idle);
- mService.getJobStore().forEachJob(update);
- if (update.mChanged) {
- changed = true;
- }
- }
- if (changed) {
- mStateChangedListener.onControllerStateChanged();
- }
- }
-
- @Override
- public void onParoleStateChanged(boolean isParoleOn) {
- if (DEBUG) {
- Slog.d(TAG, "Parole on: " + isParoleOn);
- }
- setAppIdleParoleOn(isParoleOn);
- }
- }
-}
diff --git a/services/core/java/com/android/server/job/controllers/BackgroundJobsController.java b/services/core/java/com/android/server/job/controllers/BackgroundJobsController.java
index 36e7511..b698e5b 100644
--- a/services/core/java/com/android/server/job/controllers/BackgroundJobsController.java
+++ b/services/core/java/com/android/server/job/controllers/BackgroundJobsController.java
@@ -28,17 +28,32 @@
import com.android.server.AppStateTracker.Listener;
import com.android.server.LocalServices;
import com.android.server.job.JobSchedulerService;
+import com.android.server.job.JobStore;
import com.android.server.job.StateControllerProto;
import com.android.server.job.StateControllerProto.BackgroundJobsController.TrackedJob;
import java.util.function.Consumer;
import java.util.function.Predicate;
+/**
+ * Tracks the following pieces of JobStatus state:
+ *
+ * - the CONSTRAINT_BACKGROUND_NOT_RESTRICTED general constraint bit, which
+ * is used to selectively permit battery-saver exempted jobs to run; and
+ *
+ * - the uid-active boolean state expressed by the AppStateTracker. Jobs in 'active'
+ * uids are inherently eligible to run jobs regardless of the uid's standby bucket.
+ */
public final class BackgroundJobsController extends StateController {
private static final String TAG = "JobScheduler.Background";
private static final boolean DEBUG = JobSchedulerService.DEBUG
|| Log.isLoggable(TAG, Log.DEBUG);
+ // Tri-state about possible "is this uid 'active'?" knowledge
+ static final int UNKNOWN = 0;
+ static final int KNOWN_ACTIVE = 1;
+ static final int KNOWN_INACTIVE = 2;
+
private final AppStateTracker mAppStateTracker;
public BackgroundJobsController(JobSchedulerService service) {
@@ -51,7 +66,7 @@
@Override
public void maybeStartTrackingJobLocked(JobStatus jobStatus, JobStatus lastJob) {
- updateSingleJobRestrictionLocked(jobStatus);
+ updateSingleJobRestrictionLocked(jobStatus, UNKNOWN);
}
@Override
@@ -137,23 +152,24 @@
}
private void updateAllJobRestrictionsLocked() {
- updateJobRestrictionsLocked(/*filterUid=*/ -1);
+ updateJobRestrictionsLocked(/*filterUid=*/ -1, UNKNOWN);
}
- private void updateJobRestrictionsForUidLocked(int uid) {
-
- // TODO Use forEachJobForSourceUid() once we have it.
-
- updateJobRestrictionsLocked(/*filterUid=*/ uid);
+ private void updateJobRestrictionsForUidLocked(int uid, boolean isActive) {
+ updateJobRestrictionsLocked(uid, (isActive) ? KNOWN_ACTIVE : KNOWN_INACTIVE);
}
- private void updateJobRestrictionsLocked(int filterUid) {
- final UpdateJobFunctor updateTrackedJobs =
- new UpdateJobFunctor(filterUid);
+ private void updateJobRestrictionsLocked(int filterUid, int newActiveState) {
+ final UpdateJobFunctor updateTrackedJobs = new UpdateJobFunctor(newActiveState);
final long start = DEBUG ? SystemClock.elapsedRealtimeNanos() : 0;
- mService.getJobStore().forEachJob(updateTrackedJobs);
+ final JobStore store = mService.getJobStore();
+ if (filterUid > 0) {
+ store.forEachJobForSourceUid(filterUid, updateTrackedJobs);
+ } else {
+ store.forEachJob(updateTrackedJobs);
+ }
final long time = DEBUG ? (SystemClock.elapsedRealtimeNanos() - start) : 0;
if (DEBUG) {
@@ -170,7 +186,7 @@
}
}
- boolean updateSingleJobRestrictionLocked(JobStatus jobStatus) {
+ boolean updateSingleJobRestrictionLocked(JobStatus jobStatus, int activeState) {
final int uid = jobStatus.getSourceUid();
final String packageName = jobStatus.getSourcePackageName();
@@ -179,28 +195,32 @@
(jobStatus.getInternalFlags() & JobStatus.INTERNAL_FLAG_HAS_FOREGROUND_EXEMPTION)
!= 0);
- return jobStatus.setBackgroundNotRestrictedConstraintSatisfied(canRun);
+ final boolean isActive;
+ if (activeState == UNKNOWN) {
+ isActive = mAppStateTracker.isUidActive(uid);
+ } else {
+ isActive = (activeState == KNOWN_ACTIVE);
+ }
+ boolean didChange = jobStatus.setBackgroundNotRestrictedConstraintSatisfied(canRun);
+ didChange |= jobStatus.setUidActive(isActive);
+ return didChange;
}
private final class UpdateJobFunctor implements Consumer<JobStatus> {
- private final int mFilterUid;
-
+ final int activeState;
boolean mChanged = false;
int mTotalCount = 0;
int mCheckedCount = 0;
- UpdateJobFunctor(int filterUid) {
- mFilterUid = filterUid;
+ public UpdateJobFunctor(int newActiveState) {
+ activeState = newActiveState;
}
@Override
public void accept(JobStatus jobStatus) {
mTotalCount++;
- if ((mFilterUid > 0) && (mFilterUid != jobStatus.getSourceUid())) {
- return;
- }
mCheckedCount++;
- if (updateSingleJobRestrictionLocked(jobStatus)) {
+ if (updateSingleJobRestrictionLocked(jobStatus, activeState)) {
mChanged = true;
}
}
@@ -215,16 +235,16 @@
}
@Override
- public void updateJobsForUid(int uid) {
+ public void updateJobsForUid(int uid, boolean isActive) {
synchronized (mLock) {
- updateJobRestrictionsForUidLocked(uid);
+ updateJobRestrictionsForUidLocked(uid, isActive);
}
}
@Override
- public void updateJobsForUidPackage(int uid, String packageName) {
+ public void updateJobsForUidPackage(int uid, String packageName, boolean isActive) {
synchronized (mLock) {
- updateJobRestrictionsForUidLocked(uid);
+ updateJobRestrictionsForUidLocked(uid, isActive);
}
}
};
diff --git a/services/core/java/com/android/server/job/controllers/JobStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index 5616197..578a32c 100644
--- a/services/core/java/com/android/server/job/controllers/JobStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -73,7 +73,6 @@
static final int CONSTRAINT_TIMING_DELAY = 1<<31;
static final int CONSTRAINT_DEADLINE = 1<<30;
static final int CONSTRAINT_CONNECTIVITY = 1<<28;
- static final int CONSTRAINT_APP_NOT_IDLE = 1<<27;
static final int CONSTRAINT_CONTENT_TRIGGER = 1<<26;
static final int CONSTRAINT_DEVICE_NOT_DOZING = 1<<25;
static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1<<22;
@@ -153,6 +152,9 @@
// Set to true if doze constraint was satisfied due to app being whitelisted.
public boolean dozeWhitelisted;
+ // Set to true when the app is "active" per AppStateTracker
+ public boolean uidActive;
+
/**
* Flag for {@link #trackingControllers}: the battery controller is currently tracking this job.
*/
@@ -838,10 +840,6 @@
return setConstraintSatisfied(CONSTRAINT_CONNECTIVITY, state);
}
- boolean setAppNotIdleConstraintSatisfied(boolean state) {
- return setConstraintSatisfied(CONSTRAINT_APP_NOT_IDLE, state);
- }
-
boolean setContentTriggerConstraintSatisfied(boolean state) {
return setConstraintSatisfied(CONSTRAINT_CONTENT_TRIGGER, state);
}
@@ -855,6 +853,14 @@
return setConstraintSatisfied(CONSTRAINT_BACKGROUND_NOT_RESTRICTED, state);
}
+ boolean setUidActive(final boolean newActiveState) {
+ if (newActiveState != uidActive) {
+ uidActive = newActiveState;
+ return true;
+ }
+ return false; /* unchanged */
+ }
+
boolean setConstraintSatisfied(int constraint, boolean state) {
boolean old = (satisfiedConstraints&constraint) != 0;
if (old == state) {
@@ -904,13 +910,11 @@
// NotRestrictedInBackground implicit constraint must be satisfied
final boolean deadlineSatisfied = (!job.isPeriodic() && hasDeadlineConstraint()
&& (satisfiedConstraints & CONSTRAINT_DEADLINE) != 0);
- final boolean notIdle = (satisfiedConstraints & CONSTRAINT_APP_NOT_IDLE) != 0;
final boolean notDozing = (satisfiedConstraints & CONSTRAINT_DEVICE_NOT_DOZING) != 0
|| (job.getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) != 0;
final boolean notRestrictedInBg =
(satisfiedConstraints & CONSTRAINT_BACKGROUND_NOT_RESTRICTED) != 0;
- return (isConstraintsSatisfied() || deadlineSatisfied) && notIdle && notDozing
- && notRestrictedInBg;
+ return (isConstraintsSatisfied() || deadlineSatisfied) && notDozing && notRestrictedInBg;
}
static final int CONSTRAINTS_OF_INTEREST = CONSTRAINT_CHARGING | CONSTRAINT_BATTERY_NOT_LOW
@@ -990,9 +994,6 @@
if (job.isPersisted()) {
sb.append(" PERSISTED");
}
- if ((satisfiedConstraints&CONSTRAINT_APP_NOT_IDLE) == 0) {
- sb.append(" WAIT:APP_NOT_IDLE");
- }
if ((satisfiedConstraints&CONSTRAINT_DEVICE_NOT_DOZING) == 0) {
sb.append(" WAIT:DEV_NOT_DOZING");
}
@@ -1091,9 +1092,6 @@
if ((constraints&CONSTRAINT_CONNECTIVITY) != 0) {
pw.print(" CONNECTIVITY");
}
- if ((constraints&CONSTRAINT_APP_NOT_IDLE) != 0) {
- pw.print(" APP_NOT_IDLE");
- }
if ((constraints&CONSTRAINT_CONTENT_TRIGGER) != 0) {
pw.print(" CONTENT_TRIGGER");
}
@@ -1133,9 +1131,6 @@
if ((constraints & CONSTRAINT_CONNECTIVITY) != 0) {
proto.write(fieldId, JobStatusDumpProto.CONSTRAINT_CONNECTIVITY);
}
- if ((constraints & CONSTRAINT_APP_NOT_IDLE) != 0) {
- proto.write(fieldId, JobStatusDumpProto.CONSTRAINT_APP_NOT_IDLE);
- }
if ((constraints & CONSTRAINT_CONTENT_TRIGGER) != 0) {
proto.write(fieldId, JobStatusDumpProto.CONSTRAINT_CONTENT_TRIGGER);
}
@@ -1307,6 +1302,9 @@
if (dozeWhitelisted) {
pw.print(prefix); pw.println("Doze whitelisted: true");
}
+ if (uidActive) {
+ pw.print(prefix); pw.println("Uid: active");
+ }
}
if (trackingControllers != 0) {
pw.print(prefix); pw.print("Tracking:");
diff --git a/services/core/java/com/android/server/notification/BadgeExtractor.java b/services/core/java/com/android/server/notification/BadgeExtractor.java
index d8a30ae..d91d541 100644
--- a/services/core/java/com/android/server/notification/BadgeExtractor.java
+++ b/services/core/java/com/android/server/notification/BadgeExtractor.java
@@ -15,6 +15,8 @@
*/
package com.android.server.notification;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
+
import android.content.Context;
import android.util.Slog;
@@ -54,6 +56,11 @@
}
}
+ if (record.isIntercepted()
+ && (record.getSuppressedVisualEffects() & SUPPRESSED_EFFECT_BADGE) != 0) {
+ record.setShowBadge(false);
+ }
+
return null;
}
@@ -64,6 +71,5 @@
@Override
public void setZenHelper(ZenModeHelper helper) {
-
}
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cd387b0..b68b98d 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -22,6 +22,16 @@
import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.IMPORTANCE_MIN;
import static android.app.NotificationManager.IMPORTANCE_NONE;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECTS_UNSET;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
import static android.content.pm.PackageManager.FEATURE_LEANBACK;
import static android.content.pm.PackageManager.FEATURE_TELEVISION;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
@@ -60,8 +70,6 @@
import static android.service.notification.NotificationListenerService.REASON_TIMEOUT;
import static android.service.notification.NotificationListenerService.REASON_UNAUTOBUNDLED;
import static android.service.notification.NotificationListenerService.REASON_USER_STOPPED;
-import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF;
-import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON;
import static android.service.notification.NotificationListenerService.TRIM_FULL;
import static android.service.notification.NotificationListenerService.TRIM_LIGHT;
import static android.view.Display.DEFAULT_DISPLAY;
@@ -1342,6 +1350,7 @@
@Override
void onPolicyChanged() {
sendRegisteredOnlyBroadcast(NotificationManager.ACTION_NOTIFICATION_POLICY_CHANGED);
+ mRankingHandler.requestSort();
}
});
mRankingHelper = new RankingHelper(getContext(),
@@ -1781,6 +1790,74 @@
UsageEvents.Event.NOTIFICATION_SEEN);
}
+ protected int calculateSuppressedVisualEffects(Policy incomingPolicy, Policy currPolicy,
+ int targetSdkVersion) {
+ if (incomingPolicy.suppressedVisualEffects == SUPPRESSED_EFFECTS_UNSET) {
+ return incomingPolicy.suppressedVisualEffects;
+ }
+ final int[] effectsIntroducedInP = {
+ SUPPRESSED_EFFECT_FULL_SCREEN_INTENT,
+ SUPPRESSED_EFFECT_LIGHTS,
+ SUPPRESSED_EFFECT_PEEK,
+ SUPPRESSED_EFFECT_STATUS_BAR,
+ SUPPRESSED_EFFECT_BADGE,
+ SUPPRESSED_EFFECT_AMBIENT,
+ SUPPRESSED_EFFECT_NOTIFICATION_LIST
+ };
+
+ int newSuppressedVisualEffects = incomingPolicy.suppressedVisualEffects;
+ if (targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
+ // unset higher order bits introduced in P, maintain the user's higher order bits
+ for (int i = 0; i < effectsIntroducedInP.length ; i++) {
+ newSuppressedVisualEffects &= ~effectsIntroducedInP[i];
+ newSuppressedVisualEffects |=
+ (currPolicy.suppressedVisualEffects & effectsIntroducedInP[i]);
+ }
+ // set higher order bits according to lower order bits
+ if ((newSuppressedVisualEffects & SUPPRESSED_EFFECT_SCREEN_OFF) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_LIGHTS;
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_AMBIENT;
+ }
+ if ((newSuppressedVisualEffects & SUPPRESSED_EFFECT_SCREEN_ON) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_PEEK;
+ }
+ } else {
+ boolean hasNewEffects = (newSuppressedVisualEffects
+ - SUPPRESSED_EFFECT_SCREEN_ON - SUPPRESSED_EFFECT_SCREEN_OFF) > 0;
+ // if any of the new effects introduced in P are set
+ if (hasNewEffects) {
+ // clear out the deprecated effects
+ newSuppressedVisualEffects &= ~ (SUPPRESSED_EFFECT_SCREEN_ON
+ | SUPPRESSED_EFFECT_SCREEN_OFF);
+
+ // set the deprecated effects according to the new more specific effects
+ if ((newSuppressedVisualEffects & Policy.SUPPRESSED_EFFECT_PEEK) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_SCREEN_ON;
+ }
+ if ((newSuppressedVisualEffects & Policy.SUPPRESSED_EFFECT_LIGHTS) != 0
+ && (newSuppressedVisualEffects
+ & Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT) != 0
+ && (newSuppressedVisualEffects
+ & Policy.SUPPRESSED_EFFECT_AMBIENT) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_SCREEN_OFF;
+ }
+ } else {
+ // set higher order bits according to lower order bits
+ if ((newSuppressedVisualEffects & SUPPRESSED_EFFECT_SCREEN_OFF) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_LIGHTS;
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_AMBIENT;
+ }
+ if ((newSuppressedVisualEffects & SUPPRESSED_EFFECT_SCREEN_ON) != 0) {
+ newSuppressedVisualEffects |= SUPPRESSED_EFFECT_PEEK;
+ }
+ }
+ }
+
+ return newSuppressedVisualEffects;
+ }
+
/**
* Report to usage stats that the notification was clicked.
* @param r notification record
@@ -3063,10 +3140,9 @@
try {
final ApplicationInfo applicationInfo = mPackageManager.getApplicationInfo(pkg,
0, UserHandle.getUserId(MY_UID));
+ Policy currPolicy = mZenModeHelper.getNotificationPolicy();
if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.O_MR1) {
- Policy currPolicy = mZenModeHelper.getNotificationPolicy();
-
int priorityCategories = policy.priorityCategories;
// ignore alarm and media values from new policy
priorityCategories &= ~Policy.PRIORITY_CATEGORY_ALARMS;
@@ -3084,11 +3160,13 @@
policy.priorityCallSenders, policy.priorityMessageSenders,
policy.suppressedVisualEffects);
}
+ int newVisualEffects = calculateSuppressedVisualEffects(
+ policy, currPolicy, applicationInfo.targetSdkVersion);
+ policy = new Policy(policy.priorityCategories,
+ policy.priorityCallSenders, policy.priorityMessageSenders,
+ newVisualEffects);
- Slog.i(TAG, "setNotificationPolicy pkg=" + pkg
- + " targetSdk=" + applicationInfo.targetSdkVersion
- + " policy="
- + Policy.priorityCategoriesToString(policy.priorityCategories));
+ ZenLog.traceSetNotificationPolicy(pkg, applicationInfo.targetSdkVersion, policy);
mZenModeHelper.setNotificationPolicy(policy);
} catch (RemoteException e) {
} finally {
@@ -4465,8 +4543,7 @@
// release the light
boolean wasShowLights = mLights.remove(key);
if (record.getLight() != null && aboveThreshold
- && ((record.getSuppressedVisualEffects()
- & NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF) == 0)) {
+ && ((record.getSuppressedVisualEffects() & SUPPRESSED_EFFECT_LIGHTS) == 0)) {
mLights.add(key);
updateLightsLocked();
if (mUseAttentionLight) {
@@ -4864,11 +4941,8 @@
private void applyZenModeLocked(NotificationRecord record) {
record.setIntercepted(mZenModeHelper.shouldIntercept(record));
if (record.isIntercepted()) {
- int suppressed = (mZenModeHelper.shouldSuppressWhenScreenOff()
- ? SUPPRESSED_EFFECT_SCREEN_OFF : 0)
- | (mZenModeHelper.shouldSuppressWhenScreenOn()
- ? SUPPRESSED_EFFECT_SCREEN_ON : 0);
- record.setSuppressedVisualEffects(suppressed);
+ record.setSuppressedVisualEffects(
+ mZenModeHelper.getNotificationPolicy().suppressedVisualEffects);
} else {
record.setSuppressedVisualEffects(0);
}
diff --git a/services/core/java/com/android/server/notification/NotificationRecord.java b/services/core/java/com/android/server/notification/NotificationRecord.java
index 8d2f0dd..4404c48 100644
--- a/services/core/java/com/android/server/notification/NotificationRecord.java
+++ b/services/core/java/com/android/server/notification/NotificationRecord.java
@@ -712,13 +712,8 @@
return Objects.equals(getNotification().category, category);
}
- public boolean isAudioStream(int stream) {
- return getNotification().audioStreamType == stream;
- }
-
public boolean isAudioAttributesUsage(int usage) {
- final AudioAttributes attributes = getNotification().audioAttributes;
- return attributes != null && attributes.getUsage() == usage;
+ return mAttributes != null && mAttributes.getUsage() == usage;
}
/**
diff --git a/services/core/java/com/android/server/notification/ZenLog.java b/services/core/java/com/android/server/notification/ZenLog.java
index f7efff0f..6760875 100644
--- a/services/core/java/com/android/server/notification/ZenLog.java
+++ b/services/core/java/com/android/server/notification/ZenLog.java
@@ -16,6 +16,7 @@
package com.android.server.notification;
+import android.app.NotificationManager;
import android.content.ComponentName;
import android.media.AudioManager;
import android.net.Uri;
@@ -60,6 +61,7 @@
private static final int TYPE_DISABLE_EFFECTS = 13;
private static final int TYPE_SUPPRESSOR_CHANGED = 14;
private static final int TYPE_LISTENER_HINTS_CHANGED = 15;
+ private static final int TYPE_SET_NOTIFICATION_POLICY = 16;
private static int sNext;
private static int sSize;
@@ -108,6 +110,12 @@
append(TYPE_EXIT_CONDITION, c + "," + componentToString(component) + "," + reason);
}
+ public static void traceSetNotificationPolicy(String pkg, int targetSdk,
+ NotificationManager.Policy policy) {
+ append(TYPE_SET_NOTIFICATION_POLICY, "pkg=" + pkg + " targetSdk=" + targetSdk
+ + " NotificationPolicy=" + policy.toString());
+ }
+
public static void traceSubscribe(Uri uri, IConditionProvider provider, RemoteException e) {
append(TYPE_SUBSCRIBE, uri + "," + subscribeResult(provider, e));
}
@@ -160,6 +168,7 @@
case TYPE_DISABLE_EFFECTS: return "disable_effects";
case TYPE_SUPPRESSOR_CHANGED: return "suppressor_changed";
case TYPE_LISTENER_HINTS_CHANGED: return "listener_hints_changed";
+ case TYPE_SET_NOTIFICATION_POLICY: return "set_notification_policy";
default: return "unknown";
}
}
diff --git a/services/core/java/com/android/server/notification/ZenModeExtractor.java b/services/core/java/com/android/server/notification/ZenModeExtractor.java
index 74f9806..a0aa1c3 100644
--- a/services/core/java/com/android/server/notification/ZenModeExtractor.java
+++ b/services/core/java/com/android/server/notification/ZenModeExtractor.java
@@ -16,8 +16,8 @@
package com.android.server.notification;
-import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_OFF;
-import static android.service.notification.NotificationListenerService.SUPPRESSED_EFFECT_SCREEN_ON;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
import android.content.Context;
import android.util.Log;
@@ -49,11 +49,8 @@
record.setIntercepted(mZenModeHelper.shouldIntercept(record));
if (record.isIntercepted()) {
- int suppressed = (mZenModeHelper.shouldSuppressWhenScreenOff()
- ? SUPPRESSED_EFFECT_SCREEN_OFF : 0)
- | (mZenModeHelper.shouldSuppressWhenScreenOn()
- ? SUPPRESSED_EFFECT_SCREEN_ON : 0);
- record.setSuppressedVisualEffects(suppressed);
+ record.setSuppressedVisualEffects(
+ mZenModeHelper.getNotificationPolicy().suppressedVisualEffects);
} else {
record.setSuppressedVisualEffects(0);
}
diff --git a/services/core/java/com/android/server/notification/ZenModeFiltering.java b/services/core/java/com/android/server/notification/ZenModeFiltering.java
index a0003a5..71cee05 100644
--- a/services/core/java/com/android/server/notification/ZenModeFiltering.java
+++ b/services/core/java/com/android/server/notification/ZenModeFiltering.java
@@ -16,7 +16,10 @@
package com.android.server.notification;
+import static android.provider.Settings.Global.ZEN_MODE_OFF;
+
import android.app.Notification;
+import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.media.AudioAttributes;
@@ -30,6 +33,9 @@
import android.util.ArrayMap;
import android.util.Slog;
+import com.android.internal.messages.nano.SystemMessageProto;
+import com.android.internal.util.NotificationMessagingUtil;
+
import java.io.PrintWriter;
import java.util.Date;
import java.util.Objects;
@@ -43,9 +49,16 @@
private final Context mContext;
private ComponentName mDefaultPhoneApp;
+ private final NotificationMessagingUtil mMessagingUtil;
public ZenModeFiltering(Context context) {
mContext = context;
+ mMessagingUtil = new NotificationMessagingUtil(mContext);
+ }
+
+ public ZenModeFiltering(Context context, NotificationMessagingUtil messagingUtil) {
+ mContext = context;
+ mMessagingUtil = messagingUtil;
}
public void dump(PrintWriter pw, String prefix) {
@@ -104,6 +117,16 @@
}
public boolean shouldIntercept(int zen, ZenModeConfig config, NotificationRecord record) {
+ if (zen == ZEN_MODE_OFF) {
+ return false;
+ }
+ // Make an exception to policy for the notification saying that policy has changed
+ if (NotificationManager.Policy.areAllVisualEffectsSuppressed(config.suppressedVisualEffects)
+ && "android".equals(record.sbn.getPackageName())
+ && SystemMessageProto.SystemMessage.NOTE_ZEN_UPGRADE == record.sbn.getId()) {
+ ZenLog.traceNotIntercepted(record, "systemDndChangedNotification");
+ return false;
+ }
switch (zen) {
case Global.ZEN_MODE_NO_INTERRUPTIONS:
// #notevenalarms
@@ -192,9 +215,8 @@
return false;
}
- private static boolean isAlarm(NotificationRecord record) {
+ protected static boolean isAlarm(NotificationRecord record) {
return record.isCategory(Notification.CATEGORY_ALARM)
- || record.isAudioStream(AudioManager.STREAM_ALARM)
|| record.isAudioAttributesUsage(AudioAttributes.USAGE_ALARM);
}
@@ -234,17 +256,8 @@
&& pkg.equals(mDefaultPhoneApp.getPackageName());
}
- @SuppressWarnings("deprecation")
- private boolean isDefaultMessagingApp(NotificationRecord record) {
- final int userId = record.getUserId();
- if (userId == UserHandle.USER_NULL || userId == UserHandle.USER_ALL) return false;
- final String defaultApp = Secure.getStringForUser(mContext.getContentResolver(),
- Secure.SMS_DEFAULT_APPLICATION, userId);
- return Objects.equals(defaultApp, record.sbn.getPackageName());
- }
-
- private boolean isMessage(NotificationRecord record) {
- return record.isCategory(Notification.CATEGORY_MESSAGE) || isDefaultMessagingApp(record);
+ protected boolean isMessage(NotificationRecord record) {
+ return mMessagingUtil.isMessaging(record.sbn);
}
private static boolean audienceMatches(int source, float contactAffinity) {
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 28d692a..aa1f7d95 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -602,7 +602,8 @@
pw.println(config);
return;
}
- pw.printf("allow(alarms=%b,media=%b,system=%b,calls=%b,callsFrom=%s,repeatCallers=%b,messages=%b,messagesFrom=%s,"
+ pw.printf("allow(alarms=%b,media=%b,system=%b,calls=%b,callsFrom=%s,repeatCallers=%b,"
+ + "messages=%b,messagesFrom=%s,"
+ "events=%b,reminders=%b,whenScreenOff=%b,whenScreenOn=%b)\n",
config.allowAlarms, config.allowMedia, config.allowSystem,
config.allowCalls, ZenModeConfig.sourceToString(config.allowCallsFrom),
@@ -610,6 +611,7 @@
ZenModeConfig.sourceToString(config.allowMessagesFrom),
config.allowEvents, config.allowReminders, config.allowWhenScreenOff,
config.allowWhenScreenOn);
+ pw.printf(" disallow(visualEffects=%s)\n", config.suppressedVisualEffects);
pw.print(prefix); pw.print(" manualRule="); pw.println(config.manualRule);
if (config.automaticRules.isEmpty()) return;
final int N = config.automaticRules.size();
@@ -623,7 +625,7 @@
throws XmlPullParserException, IOException {
final ZenModeConfig config = ZenModeConfig.readXml(parser);
if (config != null) {
- if (config.version < ZenModeConfig.XML_VERSION) {
+ if (config.version < ZenModeConfig.XML_VERSION || forRestore) {
Settings.Global.putInt(mContext.getContentResolver(),
Global.SHOW_ZEN_UPGRADE_NOTIFICATION, 1);
}
@@ -1176,8 +1178,7 @@
@VisibleForTesting
protected Notification createZenUpgradeNotification() {
- Intent intent = new Intent(Settings.ACTION_ZEN_MODE_PRIORITY_SETTINGS)
- .setPackage("com.android.settings")
+ Intent intent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
final Bundle extras = new Bundle();
extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index a0e4f4f..52dd9854 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -5094,11 +5094,12 @@
pf.set(displayFrames.mOverscan);
} else if (canHideNavigationBar()
&& (sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0
- && type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW) {
+ && (type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW
+ || type == TYPE_VOLUME_OVERLAY)) {
// Asking for layout as if the nav bar is hidden, lets the application
// extend into the unrestricted overscan screen area. We only do this for
- // application windows to ensure no window that can be above the nav bar can
- // do this.
+ // application windows and certain system windows to ensure no window that
+ // can be above the nav bar can do this.
df.set(displayFrames.mOverscan);
pf.set(displayFrames.mOverscan);
// We need to tell the app about where the frame inside the overscan is, so
@@ -5158,15 +5159,6 @@
if (DEBUG_LAYOUT) Slog.v(TAG, String.format(
"Laying out IN_SCREEN status bar window: (%d,%d - %d,%d)",
pf.left, pf.top, pf.right, pf.bottom));
- } else if (type == TYPE_VOLUME_OVERLAY) {
- // Volume overlay covers everything, including the status and navbar
- cf.set(displayFrames.mUnrestricted);
- of.set(displayFrames.mUnrestricted);
- df.set(displayFrames.mUnrestricted);
- pf.set(displayFrames.mUnrestricted);
- if (DEBUG_LAYOUT) Slog.v(TAG, String.format(
- "Laying out IN_SCREEN status bar window: (%d,%d - %d,%d)",
- pf.left, pf.top, pf.right, pf.bottom));
} else if (type == TYPE_NAVIGATION_BAR || type == TYPE_NAVIGATION_BAR_PANEL) {
// The navigation bar has Real Ultimate Power.
of.set(displayFrames.mUnrestricted);
@@ -5250,8 +5242,8 @@
"): normal window");
// Otherwise, a normal window must be placed inside the content
// of all screen decorations.
- if (type == TYPE_STATUS_BAR_PANEL || type == TYPE_VOLUME_OVERLAY) {
- // Status bar panels and the volume dialog are the only windows who can go on
+ if (type == TYPE_STATUS_BAR_PANEL) {
+ // Status bar panels can go on
// top of the status bar. They are protected by the STATUS_BAR_SERVICE
// permission, so they have the same privileges as the status bar itself.
cf.set(displayFrames.mRestricted);
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index f77b0ee..d7d3922 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -68,7 +68,6 @@
import android.service.dreams.DreamManagerInternal;
import android.service.vr.IVrManager;
import android.service.vr.IVrStateCallbacks;
-import android.util.EventLog;
import android.util.KeyValueListParser;
import android.util.MathUtils;
import android.util.PrintWriterPrinter;
@@ -1487,7 +1486,7 @@
break;
}
}
- EventLog.writeEvent(EventLogTags.POWER_SLEEP_REQUESTED, numWakeLocksCleared);
+ EventLogTags.writePowerSleepRequested(numWakeLocksCleared);
// Skip dozing if requested.
if ((flags & PowerManager.GO_TO_SLEEP_FLAG_NO_DOZE) != 0) {
@@ -1572,7 +1571,7 @@
final long now = SystemClock.uptimeMillis();
final long savedWakeTimeMs = mOverriddenTimeout - now;
if (savedWakeTimeMs >= 0) {
- EventLog.writeEvent(EventLogTags.POWER_SOFT_SLEEP_REQUESTED, savedWakeTimeMs);
+ EventLogTags.writePowerSoftSleepRequested(savedWakeTimeMs);
mOverriddenTimeout = -1;
}
}
@@ -3157,6 +3156,7 @@
synchronized (mLock) {
if (mUserActivityTimeoutOverrideFromWindowManager != timeoutMillis) {
mUserActivityTimeoutOverrideFromWindowManager = timeoutMillis;
+ EventLogTags.writeUserActivityTimeoutOverride(timeoutMillis);
mDirty |= DIRTY_SETTINGS;
updatePowerStateLocked();
}
diff --git a/services/core/java/com/android/server/wm/RemoteAnimationController.java b/services/core/java/com/android/server/wm/RemoteAnimationController.java
index ed6e606..e4bb043 100644
--- a/services/core/java/com/android/server/wm/RemoteAnimationController.java
+++ b/services/core/java/com/android/server/wm/RemoteAnimationController.java
@@ -103,6 +103,7 @@
onAnimationFinished();
}
});
+ sendRunningRemoteAnimation(true);
}
private RemoteAnimationTarget[] createAnimations() {
@@ -131,6 +132,7 @@
mService.closeSurfaceTransaction("RemoteAnimationController#finished");
}
}
+ sendRunningRemoteAnimation(false);
}
private void invokeAnimationCancelled() {
@@ -148,6 +150,14 @@
}
}
+ private void sendRunningRemoteAnimation(boolean running) {
+ final int pid = mRemoteAnimationAdapter.getCallingPid();
+ if (pid == 0) {
+ throw new RuntimeException("Calling pid of remote animation was null");
+ }
+ mService.sendSetRunningRemoteAnimation(pid, running);
+ }
+
private static final class FinishedCallback extends IRemoteAnimationFinishedCallback.Stub {
RemoteAnimationController mOuter;
@@ -251,6 +261,7 @@
mHandler.removeCallbacks(mTimeoutRunnable);
releaseFinishedCallback();
invokeAnimationCancelled();
+ sendRunningRemoteAnimation(false);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index b44d8a9..6b5ad60 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -4555,6 +4555,7 @@
public static final int NOTIFY_KEYGUARD_FLAGS_CHANGED = 56;
public static final int NOTIFY_KEYGUARD_TRUSTED_CHANGED = 57;
public static final int SET_HAS_OVERLAY_UI = 58;
+ public static final int SET_RUNNING_REMOTE_ANIMATION = 59;
/**
* Used to denote that an integer field in a message will not be used.
@@ -4969,6 +4970,10 @@
mAmInternal.setHasOverlayUi(msg.arg1, msg.arg2 == 1);
}
break;
+ case SET_RUNNING_REMOTE_ANIMATION: {
+ mAmInternal.setRunningRemoteAnimation(msg.arg1, msg.arg2 == 1);
+ }
+ break;
}
if (DEBUG_WINDOW_TRACE) {
Slog.v(TAG_WM, "handleMessage: exit");
@@ -7418,5 +7423,10 @@
SurfaceControl.Builder makeSurfaceBuilder(SurfaceSession s) {
return mSurfaceBuilderFactory.make(s);
}
+
+ void sendSetRunningRemoteAnimation(int pid, boolean runningRemoteAnimation) {
+ mH.obtainMessage(H.SET_RUNNING_REMOTE_ANIMATION, pid, runningRemoteAnimation ? 1 : 0)
+ .sendToTarget();
+ }
}
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLogger.java b/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLogger.java
index 0aaf32c..0967652 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLogger.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLogger.java
@@ -30,6 +30,7 @@
import android.util.Slog;
import com.android.server.ServiceThread;
+import com.android.server.net.BaseNetdEventCallback;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -50,7 +51,7 @@
private ServiceThread mHandlerThread;
private NetworkLoggingHandler mNetworkLoggingHandler;
- private final INetdEventCallback mNetdEventCallback = new INetdEventCallback.Stub() {
+ private final INetdEventCallback mNetdEventCallback = new BaseNetdEventCallback() {
@Override
public void onDnsEvent(String hostname, String[] ipAddresses, int ipAddressesCount,
long timestamp, int uid) {
diff --git a/services/tests/servicestests/src/com/android/server/AppStateTrackerTest.java b/services/tests/servicestests/src/com/android/server/AppStateTrackerTest.java
index b62f1ce..5daacd7 100644
--- a/services/tests/servicestests/src/com/android/server/AppStateTrackerTest.java
+++ b/services/tests/servicestests/src/com/android/server/AppStateTrackerTest.java
@@ -25,6 +25,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
@@ -729,8 +730,8 @@
private void assertNoCallbacks(Listener l) throws Exception {
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -752,8 +753,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -766,8 +767,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(1)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -796,8 +797,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2));
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -808,8 +809,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2));
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -819,8 +820,8 @@
setAppOps(UID_10_2, PACKAGE_2, false);
verify(l, times(0)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -835,8 +836,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2));
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(1)).updateJobsForUidPackage(eq(UID_10_2), eq(PACKAGE_2), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -849,8 +850,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(1)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -864,8 +865,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -876,8 +877,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(1)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -889,8 +890,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -901,8 +902,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -915,8 +916,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -928,8 +929,8 @@
waitUntilMainHandlerDrain();
// Called once for updating all whitelist and once for updating temp whitelist
verify(l, times(2)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -940,8 +941,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(1)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -953,8 +954,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -965,8 +966,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(anyInt());
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(anyInt(), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -985,8 +986,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(1)).unblockAlarmsForUid(eq(UID_10_1));
@@ -997,8 +998,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -1009,8 +1010,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(1)).unblockAlarmsForUid(eq(UID_10_1));
@@ -1021,8 +1022,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -1035,8 +1036,8 @@
waitUntilMainHandlerDrain();
verify(l, times(1)).updateAllJobs();
- verify(l, times(0)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(0)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(1)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -1047,8 +1048,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(1)).unblockAlarmsForUid(eq(UID_10_1));
@@ -1059,8 +1060,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
@@ -1071,8 +1072,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(1)).unblockAlarmsForUid(eq(UID_10_1));
@@ -1083,8 +1084,8 @@
waitUntilMainHandlerDrain();
verify(l, times(0)).updateAllJobs();
- verify(l, times(1)).updateJobsForUid(eq(UID_10_1));
- verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString());
+ verify(l, times(1)).updateJobsForUid(eq(UID_10_1), anyBoolean());
+ verify(l, times(0)).updateJobsForUidPackage(anyInt(), anyString(), anyBoolean());
verify(l, times(0)).unblockAllUnrestrictedAlarms();
verify(l, times(0)).unblockAlarmsForUid(anyInt());
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
index fdabfb4..5906db3 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStarterTests.java
@@ -30,6 +30,7 @@
import android.app.IApplicationThread;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.ActivityInfo.WindowLayout;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.graphics.Rect;
@@ -39,6 +40,7 @@
import android.service.voice.IVoiceInteractionSession;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
+import android.view.Gravity;
import org.junit.runner.RunWith;
import org.junit.Test;
@@ -52,6 +54,7 @@
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.anyObject;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
@@ -64,6 +67,8 @@
import com.android.internal.os.BatteryStatsImpl;
import com.android.server.am.ActivityStarter.Factory;
+import com.android.server.am.LaunchParamsController.LaunchParamsModifier;
+import com.android.server.am.TaskRecord.TaskRecordFactory;
/**
* Tests for the {@link ActivityStarter} class.
@@ -207,7 +212,8 @@
if (aInfo != null) {
aInfo.applicationInfo = new ApplicationInfo();
- aInfo.applicationInfo.packageName = builder.getDefaultComponentPackageName();
+ aInfo.applicationInfo.packageName =
+ ActivityBuilder.getDefaultComponent().getPackageName();
}
// Offset uid by one from {@link ActivityInfo} to simulate different uids.
@@ -284,9 +290,85 @@
}
}
-// TODO(b/69270257): Add test to verify task layout is passed additional data such as activity and
-// source.
-// @Test
-// public void testCreateTaskLayout() {
-// }
+ private ActivityStarter prepareStarter() {
+ // always allow test to start activity.
+ doReturn(true).when(mService.mStackSupervisor).checkStartAnyActivityPermission(
+ any(), any(), any(), anyInt(), anyInt(), anyInt(), any(),
+ anyBoolean(), any(), any(), any());
+
+ // instrument the stack and task used.
+ final ActivityStack stack = spy(mService.mStackSupervisor.getDefaultDisplay().createStack(
+ WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */));
+ final TaskRecord task =
+ spy(new TaskBuilder(mService.mStackSupervisor).setStack(stack).build());
+
+ // supervisor needs a focused stack.
+ mService.mStackSupervisor.mFocusedStack = task.getStack();
+
+ // use factory that only returns spy task.
+ final TaskRecordFactory factory = mock(TaskRecordFactory.class);
+ TaskRecord.setTaskRecordFactory(factory);
+
+ // return task when created.
+ doReturn(task).when(factory).create(any(), anyInt(), any(), any(), any(), any());
+
+ // direct starter to use spy stack.
+ doReturn(stack).when(mService.mStackSupervisor)
+ .getLaunchStack(any(), any(), any(), anyBoolean());
+ doReturn(stack).when(mService.mStackSupervisor)
+ .getLaunchStack(any(), any(), any(), anyBoolean(), anyInt());
+
+ // ignore the start request.
+ doNothing().when(stack)
+ .startActivityLocked(any(), any(), anyBoolean(), anyBoolean(), any());
+
+ // ignore requests to create window container.
+ doNothing().when(task).createWindowContainer(anyBoolean(), anyBoolean());
+
+ return new ActivityStarter(mController, mService,
+ mService.mStackSupervisor, mock(ActivityStartInterceptor.class));
+ }
+
+ /**
+ * Ensures that values specified at launch time are passed to {@link LaunchParamsModifier}
+ * when we are laying out a new task.
+ */
+ @Test
+ public void testCreateTaskLayout() {
+ // modifier for validating passed values.
+ final LaunchParamsModifier modifier = mock(LaunchParamsModifier.class);
+ mService.mStackSupervisor.getLaunchParamsController().registerModifier(modifier);
+
+ // add custom values to activity info to make unique.
+ final ActivityInfo info = new ActivityInfo();
+ final Rect launchBounds = new Rect(0, 0, 20, 30);
+ final Intent intent = new Intent();
+
+ intent.setComponent(ActivityBuilder.getDefaultComponent());
+
+ final WindowLayout windowLayout =
+ new WindowLayout(10, .5f, 20, 1.0f, Gravity.NO_GRAVITY, 1, 1);
+
+ info.windowLayout = windowLayout;
+ info.applicationInfo = new ApplicationInfo();
+ info.applicationInfo.packageName = ActivityBuilder.getDefaultComponent().getPackageName();
+
+ // create starter.
+ final ActivityStarter optionStarter = prepareStarter();
+
+ final ActivityOptions options = ActivityOptions.makeBasic();
+ options.setLaunchBounds(launchBounds);
+
+ // run starter.
+ optionStarter
+ .setIntent(intent)
+ .setReason("testCreateTaskLayout")
+ .setActivityInfo(info)
+ .setActivityOptions(new SafeActivityOptions(options))
+ .execute();
+
+ // verify that values are passed to the modifier.
+ verify(modifier, times(1)).onCalculate(any(), eq(windowLayout), any(), any(), eq(options),
+ any(), any());
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index 1195188..a916585 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -101,6 +101,7 @@
protected ActivityManagerService setupActivityManagerService(ActivityManagerService service) {
service = spy(service);
doReturn(mock(IPackageManager.class)).when(service).getPackageManager();
+ doNothing().when(service).grantEphemeralAccessLocked(anyInt(), any(), anyInt(), anyInt());
service.mWindowManager = prepareMockWindowManager();
return service;
}
@@ -131,6 +132,11 @@
return this;
}
+ static ComponentName getDefaultComponent() {
+ return ComponentName.createRelative(DEFAULT_COMPONENT_PACKAGE_NAME,
+ DEFAULT_COMPONENT_PACKAGE_NAME);
+ }
+
ActivityBuilder setTask(TaskRecord task) {
mTaskRecord = task;
return this;
@@ -151,10 +157,6 @@
return this;
}
- String getDefaultComponentPackageName() {
- return DEFAULT_COMPONENT_PACKAGE_NAME;
- }
-
ActivityRecord build() {
if (mComponent == null) {
final int id = sCurrentActivityId++;
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
index 142041a..cfc7430 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/BadgeExtractorTest.java
@@ -18,10 +18,13 @@
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static android.app.NotificationManager.IMPORTANCE_HIGH;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
import android.app.ActivityManager;
import android.app.Notification;
@@ -149,4 +152,52 @@
assertFalse(r.canShowBadge());
}
+
+ @Test
+ public void testDndOverridesYes() {
+ BadgeExtractor extractor = new BadgeExtractor();
+ extractor.setConfig(mConfig);
+
+ when(mConfig.badgingEnabled(mUser)).thenReturn(true);
+ when(mConfig.canShowBadge(mPkg, mUid)).thenReturn(true);
+ NotificationRecord r = getNotificationRecord(true, IMPORTANCE_UNSPECIFIED);
+ r.setIntercepted(true);
+ r.setSuppressedVisualEffects(SUPPRESSED_EFFECT_BADGE);
+
+ extractor.process(r);
+
+ assertFalse(r.canShowBadge());
+ }
+
+ @Test
+ public void testDndOConsidersInterception() {
+ BadgeExtractor extractor = new BadgeExtractor();
+ extractor.setConfig(mConfig);
+
+ when(mConfig.badgingEnabled(mUser)).thenReturn(true);
+ when(mConfig.canShowBadge(mPkg, mUid)).thenReturn(true);
+ NotificationRecord r = getNotificationRecord(true, IMPORTANCE_UNSPECIFIED);
+ r.setIntercepted(false);
+ r.setSuppressedVisualEffects(SUPPRESSED_EFFECT_BADGE);
+
+ extractor.process(r);
+
+ assertTrue(r.canShowBadge());
+ }
+
+ @Test
+ public void testDndConsidersSuppressedVisualEffects() {
+ BadgeExtractor extractor = new BadgeExtractor();
+ extractor.setConfig(mConfig);
+
+ when(mConfig.badgingEnabled(mUser)).thenReturn(true);
+ when(mConfig.canShowBadge(mPkg, mUid)).thenReturn(true);
+ NotificationRecord r = getNotificationRecord(true, IMPORTANCE_UNSPECIFIED);
+ r.setIntercepted(true);
+ r.setSuppressedVisualEffects(SUPPRESSED_EFFECT_LIGHTS);
+
+ extractor.process(r);
+
+ assertTrue(r.canShowBadge());
+ }
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
index 7b2c040..4fe54b9 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -22,8 +22,19 @@
import static android.app.NotificationManager.IMPORTANCE_MAX;
import static android.app.NotificationManager.IMPORTANCE_NONE;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
import static android.content.pm.PackageManager.FEATURE_WATCH;
import static android.content.pm.PackageManager.PERMISSION_DENIED;
+import static android.os.Build.VERSION_CODES.O_MR1;
+import static android.os.Build.VERSION_CODES.P;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -2530,4 +2541,125 @@
verify(mAm, times(1)).revokeUriPermissionFromOwner(any(), eq(message1.getDataUri()),
anyInt(), anyInt());
}
+
+ @Test
+ public void testSetNotificationPolicy_preP_setOldFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_SCREEN_OFF);
+
+ int expected = SUPPRESSED_EFFECT_BADGE
+ | SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_SCREEN_OFF
+ | SUPPRESSED_EFFECT_PEEK | SUPPRESSED_EFFECT_AMBIENT
+ | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, O_MR1);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testSetNotificationPolicy_preP_setNewFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_NOTIFICATION_LIST);
+
+ int expected = SUPPRESSED_EFFECT_BADGE;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, O_MR1);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testSetNotificationPolicy_preP_setOldNewFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_STATUS_BAR);
+
+ int expected =
+ SUPPRESSED_EFFECT_BADGE | SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_PEEK;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, O_MR1);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testSetNotificationPolicy_P_setOldFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_SCREEN_OFF);
+
+ int expected = SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_SCREEN_OFF
+ | SUPPRESSED_EFFECT_PEEK | SUPPRESSED_EFFECT_AMBIENT
+ | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, P);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testSetNotificationPolicy_P_setNewFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_NOTIFICATION_LIST | SUPPRESSED_EFFECT_AMBIENT
+ | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT);
+
+ int expected = SUPPRESSED_EFFECT_NOTIFICATION_LIST | SUPPRESSED_EFFECT_SCREEN_OFF
+ | SUPPRESSED_EFFECT_AMBIENT | SUPPRESSED_EFFECT_LIGHTS
+ | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, P);
+
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testSetNotificationPolicy_P_setOldNewFields() {
+ ZenModeHelper mZenModeHelper = mock(ZenModeHelper.class);
+ mService.mZenModeHelper = mZenModeHelper;
+ NotificationManager.Policy userPolicy =
+ new NotificationManager.Policy(0, 0, 0, SUPPRESSED_EFFECT_BADGE);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(userPolicy);
+
+ NotificationManager.Policy appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_STATUS_BAR);
+
+ int expected = SUPPRESSED_EFFECT_STATUS_BAR;
+ int actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, P);
+
+ assertEquals(expected, actual);
+
+ appPolicy = new NotificationManager.Policy(0, 0, 0,
+ SUPPRESSED_EFFECT_SCREEN_ON | SUPPRESSED_EFFECT_AMBIENT
+ | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT);
+
+ expected = SUPPRESSED_EFFECT_SCREEN_OFF | SUPPRESSED_EFFECT_AMBIENT
+ | SUPPRESSED_EFFECT_LIGHTS | SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
+ actual = mService.calculateSuppressedVisualEffects(appPolicy, userPolicy, P);
+
+ assertEquals(expected, actual);
+ }
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeExtractorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeExtractorTest.java
index faba6b6..beff0d1 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeExtractorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeExtractorTest.java
@@ -17,6 +17,8 @@
package com.android.server.notification;
import static android.app.NotificationManager.IMPORTANCE_LOW;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -57,6 +59,8 @@
assertFalse(r.isIntercepted());
when(mZenModeHelper.shouldIntercept(any())).thenReturn(true);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(
+ new NotificationManager.Policy(0,0,0));
extractor.process(r);
@@ -70,7 +74,8 @@
NotificationRecord r = generateRecord();
when(mZenModeHelper.shouldIntercept(any())).thenReturn(false);
- when(mZenModeHelper.shouldSuppressWhenScreenOff()).thenReturn(false);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(
+ new NotificationManager.Policy(0,0,0));
extractor.process(r);
@@ -84,13 +89,14 @@
NotificationRecord r = generateRecord();
when(mZenModeHelper.shouldIntercept(any())).thenReturn(true);
- when(mZenModeHelper.shouldSuppressWhenScreenOff()).thenReturn(true);
- when(mZenModeHelper.shouldSuppressWhenScreenOn()).thenReturn(true);
+ when(mZenModeHelper.getNotificationPolicy()).thenReturn(
+ new NotificationManager.Policy(0,0,0, SUPPRESSED_EFFECT_PEEK
+ | SUPPRESSED_EFFECT_NOTIFICATION_LIST));
extractor.process(r);
- assertEquals(NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_OFF
- | NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON,
+ assertEquals(NotificationManager.Policy.SUPPRESSED_EFFECT_PEEK
+ | NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST,
r.getSuppressedVisualEffects());
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeFilteringTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeFilteringTest.java
new file mode 100644
index 0000000..c0bd7cc
--- /dev/null
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeFilteringTest.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distriZenbuted on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.notification;
+
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
+import static android.provider.Settings.Global.ZEN_MODE_ALARMS;
+import static android.provider.Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
+import static android.provider.Settings.Global.ZEN_MODE_NO_INTERRUPTIONS;
+import static android.provider.Settings.Global.ZEN_MODE_OFF;
+
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.media.AudioAttributes;
+import android.service.notification.StatusBarNotification;
+import android.service.notification.ZenModeConfig;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.testing.AndroidTestingRunner;
+import android.testing.TestableLooper;
+
+import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
+import com.android.internal.util.NotificationMessagingUtil;
+import com.android.server.UiServiceTestCase;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+@SmallTest
+@RunWith(AndroidTestingRunner.class)
+@TestableLooper.RunWithLooper
+public class ZenModeFilteringTest extends UiServiceTestCase {
+
+ @Mock
+ private NotificationMessagingUtil mMessagingUtil;
+ private ZenModeFiltering mZenModeFiltering;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mZenModeFiltering = new ZenModeFiltering(mContext, mMessagingUtil);
+ }
+
+ private NotificationRecord getNotificationRecord() {
+ return getNotificationRecord(mock(NotificationChannel.class));
+ }
+
+ private NotificationRecord getNotificationRecord(NotificationChannel c) {
+ StatusBarNotification sbn = mock(StatusBarNotification.class);
+ when(sbn.getNotification()).thenReturn(mock(Notification.class));
+ return new NotificationRecord(mContext, sbn, c);
+ }
+
+ @Test
+ public void testIsMessage() {
+ NotificationRecord r = getNotificationRecord();
+
+ when(mMessagingUtil.isMessaging(any())).thenReturn(true);
+ assertTrue(mZenModeFiltering.isMessage(r));
+
+ when(mMessagingUtil.isMessaging(any())).thenReturn(false);
+ assertFalse(mZenModeFiltering.isMessage(r));
+ }
+
+ @Test
+ public void testIsAlarm() {
+ NotificationChannel c = mock(NotificationChannel.class);
+ when(c.getAudioAttributes()).thenReturn(new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_ALARM)
+ .build());
+ NotificationRecord r = getNotificationRecord(c);
+ assertTrue(mZenModeFiltering.isAlarm(r));
+
+ r = getNotificationRecord();
+ r.sbn.getNotification().category = Notification.CATEGORY_ALARM;
+ assertTrue(mZenModeFiltering.isAlarm(r));
+ }
+
+ @Test
+ public void testIsAlarm_wrongCategory() {
+ NotificationRecord r = getNotificationRecord();
+ r.sbn.getNotification().category = Notification.CATEGORY_CALL;
+ assertFalse(mZenModeFiltering.isAlarm(r));
+ }
+
+ @Test
+ public void testIsAlarm_wrongUsage() {
+ NotificationChannel c = mock(NotificationChannel.class);
+ when(c.getAudioAttributes()).thenReturn(new AudioAttributes.Builder()
+ .setUsage(AudioAttributes.USAGE_NOTIFICATION)
+ .build());
+ NotificationRecord r = getNotificationRecord(c);
+ assertFalse(mZenModeFiltering.isAlarm(r));
+ }
+
+ @Test
+ public void testSuppressDNDInfo_yes_VisEffectsAllowed() {
+ NotificationRecord r = getNotificationRecord();
+ when(r.sbn.getPackageName()).thenReturn("android");
+ when(r.sbn.getId()).thenReturn(SystemMessage.NOTE_ZEN_UPGRADE);
+ ZenModeConfig config = mock(ZenModeConfig.class);
+ config.suppressedVisualEffects = NotificationManager.Policy.getAllSuppressedVisualEffects()
+ - SUPPRESSED_EFFECT_STATUS_BAR;
+
+ assertTrue(mZenModeFiltering.shouldIntercept(ZEN_MODE_IMPORTANT_INTERRUPTIONS, config, r));
+ }
+
+ @Test
+ public void testSuppressDNDInfo_yes_WrongId() {
+ NotificationRecord r = getNotificationRecord();
+ when(r.sbn.getPackageName()).thenReturn("android");
+ when(r.sbn.getId()).thenReturn(SystemMessage.NOTE_ACCOUNT_CREDENTIAL_PERMISSION);
+ ZenModeConfig config = mock(ZenModeConfig.class);
+ config.suppressedVisualEffects = NotificationManager.Policy.getAllSuppressedVisualEffects();
+
+ assertTrue(mZenModeFiltering.shouldIntercept(ZEN_MODE_IMPORTANT_INTERRUPTIONS, config, r));
+ }
+
+ @Test
+ public void testSuppressDNDInfo_yes_WrongPackage() {
+ NotificationRecord r = getNotificationRecord();
+ when(r.sbn.getPackageName()).thenReturn("android2");
+ when(r.sbn.getId()).thenReturn(SystemMessage.NOTE_ZEN_UPGRADE);
+ ZenModeConfig config = mock(ZenModeConfig.class);
+ config.suppressedVisualEffects = NotificationManager.Policy.getAllSuppressedVisualEffects();
+
+ assertTrue(mZenModeFiltering.shouldIntercept(ZEN_MODE_IMPORTANT_INTERRUPTIONS, config, r));
+ }
+
+ @Test
+ public void testSuppressDNDInfo_no() {
+ NotificationRecord r = getNotificationRecord();
+ when(r.sbn.getPackageName()).thenReturn("android");
+ when(r.sbn.getId()).thenReturn(SystemMessage.NOTE_ZEN_UPGRADE);
+ ZenModeConfig config = mock(ZenModeConfig.class);
+ config.suppressedVisualEffects = NotificationManager.Policy.getAllSuppressedVisualEffects();
+
+ assertFalse(mZenModeFiltering.shouldIntercept(ZEN_MODE_IMPORTANT_INTERRUPTIONS, config, r));
+ assertFalse(mZenModeFiltering.shouldIntercept(ZEN_MODE_ALARMS, config, r));
+ assertFalse(mZenModeFiltering.shouldIntercept(ZEN_MODE_NO_INTERRUPTIONS, config, r));
+ }
+
+ @Test
+ public void testSuppressAnything_yes_ZenModeOff() {
+ NotificationRecord r = getNotificationRecord();
+ when(r.sbn.getPackageName()).thenReturn("bananas");
+ ZenModeConfig config = mock(ZenModeConfig.class);
+
+ assertFalse(mZenModeFiltering.shouldIntercept(ZEN_MODE_OFF, config, r));
+ }
+}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
index 5bfa15a..9008803 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
@@ -16,6 +16,8 @@
package com.android.server.notification;
+import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_BADGE;
+
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertEquals;
import static junit.framework.TestCase.assertTrue;
@@ -34,6 +36,7 @@
import static org.mockito.Mockito.when;
import android.app.NotificationManager;
+import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
@@ -48,8 +51,11 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import android.util.Xml;
+import com.android.internal.R;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
+import com.android.internal.util.FastXmlSerializer;
import com.android.server.UiServiceTestCase;
import android.util.Slog;
@@ -58,6 +64,13 @@
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlSerializer;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
@SmallTest
@RunWith(AndroidTestingRunner.class)
@@ -80,12 +93,27 @@
mContext = spy(getContext());
mContentResolver = mContext.getContentResolver();
when(mContext.getResources()).thenReturn(mResources);
+ when(mResources.getString(R.string.zen_mode_default_every_night_name)).thenReturn("night");
+ when(mResources.getString(R.string.zen_mode_default_events_name)).thenReturn("events");
when(mContext.getSystemService(NotificationManager.class)).thenReturn(mNotificationManager);
mZenModeHelperSpy = spy(new ZenModeHelper(mContext, mTestableLooper.getLooper(),
mConditionProviders));
}
+ private ByteArrayOutputStream writeXmlAndPurge(boolean forBackup)
+ throws Exception {
+ XmlSerializer serializer = new FastXmlSerializer();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ serializer.setOutput(new BufferedOutputStream(baos), "utf-8");
+ serializer.startDocument(null, true);
+ mZenModeHelperSpy.writeXml(serializer, forBackup);
+ serializer.endDocument();
+ serializer.flush();
+ mZenModeHelperSpy.setConfig(new ZenModeConfig(), "writing xml");
+ return baos;
+ }
+
@Test
public void testZenOff_NoMuteApplied() {
mZenModeHelperSpy.mZenMode = Settings.Global.ZEN_MODE_OFF;
@@ -497,4 +525,71 @@
verify(mAudioManager, never()).setRingerModeInternal(AudioManager.RINGER_MODE_NORMAL,
mZenModeHelperSpy.TAG);
}
+
+ @Test
+ public void testParcelConfig() {
+ mZenModeHelperSpy.mZenMode = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
+ mZenModeHelperSpy.mConfig.allowAlarms = false;
+ mZenModeHelperSpy.mConfig.allowMedia = false;
+ mZenModeHelperSpy.mConfig.allowSystem = false;
+ mZenModeHelperSpy.mConfig.allowReminders = true;
+ mZenModeHelperSpy.mConfig.allowCalls = true;
+ mZenModeHelperSpy.mConfig.allowMessages = true;
+ mZenModeHelperSpy.mConfig.allowEvents = true;
+ mZenModeHelperSpy.mConfig.allowRepeatCallers= true;
+ mZenModeHelperSpy.mConfig.allowWhenScreenOff = true;
+ mZenModeHelperSpy.mConfig.allowWhenScreenOn = true;
+ mZenModeHelperSpy.mConfig.suppressedVisualEffects = SUPPRESSED_EFFECT_BADGE;
+ mZenModeHelperSpy.mConfig.manualRule = new ZenModeConfig.ZenRule();
+ mZenModeHelperSpy.mConfig.manualRule.component = new ComponentName("a", "a");
+ mZenModeHelperSpy.mConfig.manualRule.enabled = true;
+ mZenModeHelperSpy.mConfig.manualRule.snoozing = true;
+
+ ZenModeConfig actual = mZenModeHelperSpy.mConfig.copy();
+
+ assertEquals(mZenModeHelperSpy.mConfig, actual);
+ }
+
+ @Test
+ public void testWriteXml() throws Exception {
+ mZenModeHelperSpy.mZenMode = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
+ mZenModeHelperSpy.mConfig.allowAlarms = false;
+ mZenModeHelperSpy.mConfig.allowMedia = false;
+ mZenModeHelperSpy.mConfig.allowSystem = false;
+ mZenModeHelperSpy.mConfig.allowReminders = true;
+ mZenModeHelperSpy.mConfig.allowCalls = true;
+ mZenModeHelperSpy.mConfig.allowMessages = true;
+ mZenModeHelperSpy.mConfig.allowEvents = true;
+ mZenModeHelperSpy.mConfig.allowRepeatCallers= true;
+ mZenModeHelperSpy.mConfig.allowWhenScreenOff = true;
+ mZenModeHelperSpy.mConfig.allowWhenScreenOn = true;
+ mZenModeHelperSpy.mConfig.suppressedVisualEffects = SUPPRESSED_EFFECT_BADGE;
+ mZenModeHelperSpy.mConfig.manualRule = new ZenModeConfig.ZenRule();
+ mZenModeHelperSpy.mConfig.manualRule.zenMode =
+ Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
+ mZenModeHelperSpy.mConfig.manualRule.component = new ComponentName("a", "a");
+ mZenModeHelperSpy.mConfig.manualRule.enabled = true;
+ mZenModeHelperSpy.mConfig.manualRule.snoozing = true;
+
+ ZenModeConfig expected = mZenModeHelperSpy.mConfig.copy();
+
+ ByteArrayOutputStream baos = writeXmlAndPurge(false);
+ XmlPullParser parser = Xml.newPullParser();
+ parser.setInput(new BufferedInputStream(
+ new ByteArrayInputStream(baos.toByteArray())), null);
+ parser.nextTag();
+ mZenModeHelperSpy.readXml(parser, false);
+
+ assertEquals(expected, mZenModeHelperSpy.mConfig);
+ }
+
+ @Test
+ public void testPolicyReadsSuppressedEffects() {
+ mZenModeHelperSpy.mConfig.allowWhenScreenOff = true;
+ mZenModeHelperSpy.mConfig.allowWhenScreenOn = true;
+ mZenModeHelperSpy.mConfig.suppressedVisualEffects = SUPPRESSED_EFFECT_BADGE;
+
+ NotificationManager.Policy policy = mZenModeHelperSpy.getNotificationPolicy();
+ assertEquals(SUPPRESSED_EFFECT_BADGE, policy.suppressedVisualEffects);
+ }
}
diff --git a/telephony/java/android/telephony/AccessNetworkConstants.java b/telephony/java/android/telephony/AccessNetworkConstants.java
index 7cd1612..cac9f2b 100644
--- a/telephony/java/android/telephony/AccessNetworkConstants.java
+++ b/telephony/java/android/telephony/AccessNetworkConstants.java
@@ -30,6 +30,9 @@
public static final int EUTRAN = 3;
public static final int CDMA2000 = 4;
public static final int IWLAN = 5;
+
+ /** @hide */
+ private AccessNetworkType() {};
}
/**
@@ -42,6 +45,9 @@
public static final int WWAN = 1;
/** Wireless Local Area Networks (i.e. Wifi) */
public static final int WLAN = 2;
+
+ /** @hide */
+ private TransportType() {};
}
/**
@@ -63,6 +69,9 @@
public static final int BAND_DCS1800 = 12;
public static final int BAND_PCS1900 = 13;
public static final int BAND_ER900 = 14;
+
+ /** @hide */
+ private GeranBand() {};
}
/**
@@ -92,6 +101,9 @@
/** band 23, 24 are reserved */
public static final int BAND_25 = 25;
public static final int BAND_26 = 26;
+
+ /** @hide */
+ private UtranBand() {};
}
/**
@@ -147,6 +159,9 @@
public static final int BAND_66 = 66;
public static final int BAND_68 = 68;
public static final int BAND_70 = 70;
+
+ /** @hide */
+ private EutranBand() {};
}
/**
@@ -179,5 +194,11 @@
public static final int BAND_19 = 20;
public static final int BAND_20 = 21;
public static final int BAND_21 = 22;
+
+ /** @hide */
+ private CdmaBands() {};
}
+
+ /** @hide */
+ private AccessNetworkConstants() {};
}
diff --git a/telephony/java/android/telephony/NetworkScan.java b/telephony/java/android/telephony/NetworkScan.java
index a277212..7f43ee5 100644
--- a/telephony/java/android/telephony/NetworkScan.java
+++ b/telephony/java/android/telephony/NetworkScan.java
@@ -29,9 +29,9 @@
/**
* The caller of
- * {@link TelephonyManager#requestNetworkScan(NetworkScanRequest, NetworkScanCallback)}
+ * {@link TelephonyManager#requestNetworkScan(NetworkScanRequest, Executor, NetworkScanCallback)}
* will receive an instance of {@link NetworkScan}, which contains a callback method
- * {@link #stop()} for stopping the in-progress scan.
+ * {@link #stopScan()} for stopping the in-progress scan.
*/
public class NetworkScan {
@@ -106,16 +106,24 @@
* Use this method to stop an ongoing scan. When user requests a new scan, a {@link NetworkScan}
* object will be returned, and the user can stop the scan by calling this method.
*/
- public void stop() throws RemoteException {
+ public void stopScan() {
+ ITelephony telephony = getITelephony();
+ if (telephony == null) {
+ Rlog.e(TAG, "Failed to get the ITelephony instance.");
+ }
try {
- ITelephony telephony = getITelephony();
- if (telephony != null) {
- telephony.stopNetworkScan(mSubId, mScanId);
- } else {
- throw new RemoteException("Failed to get the ITelephony instance.");
- }
+ telephony.stopNetworkScan(mSubId, mScanId);
} catch (RemoteException ex) {
Rlog.e(TAG, "stopNetworkScan RemoteException", ex);
+ }
+ }
+
+ /** @deprecated Use {@link #stopScan()} */
+ @Deprecated
+ public void stop() throws RemoteException {
+ try {
+ stopScan();
+ } catch (RuntimeException ex) {
throw new RemoteException("Failed to stop the network scan with id " + mScanId);
}
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index af3a0bb..aa76e9d 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -34,6 +34,7 @@
import android.net.ConnectivityManager;
import android.net.NetworkStats;
import android.net.Uri;
+import android.os.AsyncTask;
import android.os.BatteryStats;
import android.os.Bundle;
import android.os.Handler;
@@ -74,6 +75,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.Executor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -2754,18 +2756,17 @@
* @return ImsiEncryptionInfo Carrier specific information that will be used to encrypt the
* IMSI and IMPI. This includes the public key and the key identifier. This information
* will be stored in the device keystore. The system will return a null when no key was
- * found, and the carrier does not require a key. The system will throw the following
- * exceptions:
- * 1. IllegalArgumentException when an invalid key is sent.
- * 2. RuntimeException if the key is required but not found; and also if there was an
- * internal exception.
+ * found, and the carrier does not require a key. The system will throw
+ * IllegalArgumentException when an invalid key is sent or when key is required but
+ * not found.
* @hide
*/
public ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int keyType) {
try {
IPhoneSubInfo info = getSubscriberInfo();
if (info == null) {
- throw new RuntimeException("IMSI error: Subscriber Info is null");
+ Rlog.e(TAG,"IMSI error: Subscriber Info is null");
+ return null;
}
int subId = getSubId(SubscriptionManager.getDefaultDataSubscriptionId());
if (keyType != KEY_TYPE_EPDG && keyType != KEY_TYPE_WLAN) {
@@ -2773,20 +2774,18 @@
}
ImsiEncryptionInfo imsiEncryptionInfo = info.getCarrierInfoForImsiEncryption(
subId, keyType, mContext.getOpPackageName());
- if (imsiEncryptionInfo == null
- && isImsiEncryptionRequired(subId, keyType)) {
+ if (imsiEncryptionInfo == null && isImsiEncryptionRequired(subId, keyType)) {
Rlog.e(TAG, "IMSI error: key is required but not found");
- throw new RuntimeException("IMSI error: key is required but not found");
+ throw new IllegalArgumentException("IMSI error: key is required but not found");
}
return imsiEncryptionInfo;
} catch (RemoteException ex) {
Rlog.e(TAG, "getCarrierInfoForImsiEncryption RemoteException" + ex);
- throw new RuntimeException("IMSI error: Remote Exception");
} catch (NullPointerException ex) {
// This could happen before phone restarts due to crashing
Rlog.e(TAG, "getCarrierInfoForImsiEncryption NullPointerException" + ex);
- throw new RuntimeException("IMSI error: Null Pointer exception");
}
+ return null;
}
/**
@@ -2802,17 +2801,16 @@
try {
IPhoneSubInfo info = getSubscriberInfo();
if (info == null) {
- throw new RuntimeException("IMSI error: Subscriber Info is null");
+ Rlog.e(TAG, "IMSI error: Subscriber Info is null");
+ return;
}
int subId = getSubId(SubscriptionManager.getDefaultDataSubscriptionId());
info.resetCarrierKeysForImsiEncryption(subId, mContext.getOpPackageName());
} catch (RemoteException ex) {
Rlog.e(TAG, "getCarrierInfoForImsiEncryption RemoteException" + ex);
- throw new RuntimeException("IMSI error: Remote Exception");
} catch (NullPointerException ex) {
// This could happen before phone restarts due to crashing
Rlog.e(TAG, "getCarrierInfoForImsiEncryption NullPointerException" + ex);
- throw new RuntimeException("IMSI error: Null Pointer exception");
}
}
@@ -3788,8 +3786,6 @@
*
* @throws SecurityException if the caller does not have carrier privileges or is not the
* current default dialer
- *
- * @throws IllegalStateException if telephony service is unavailable.
*/
public void sendDialerSpecialCode(String inputCode) {
try {
@@ -3797,10 +3793,8 @@
telephony.sendDialerSpecialCode(mContext.getOpPackageName(), inputCode);
} catch (RemoteException ex) {
// This could happen if binder process crashes.
- ex.rethrowFromSystemServer();
} catch (NullPointerException ex) {
// This could happen before phone restarts due to crashing
- throw new IllegalStateException("Telephony service unavailable");
}
}
@@ -4925,10 +4919,10 @@
String v = android.provider.Settings.Global.getString(cr, name);
if (index == Integer.MAX_VALUE) {
- throw new RuntimeException("putIntAtIndex index == MAX_VALUE index=" + index);
+ throw new IllegalArgumentException("putIntAtIndex index == MAX_VALUE index=" + index);
}
if (index < 0) {
- throw new RuntimeException("putIntAtIndex index < 0 index=" + index);
+ throw new IllegalArgumentException("putIntAtIndex index < 0 index=" + index);
}
if (v != null) {
valArray = v.split(",");
@@ -5394,21 +5388,36 @@
* <p>
* Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
- * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
+ * Or the calling app has carrier privileges.
+ * @see #hasCarrierPrivileges()
*
* @param request Contains all the RAT with bands/channels that need to be scanned.
+ * @param executor The executor through which the callback should be invoked.
* @param callback Returns network scan results or errors.
* @return A NetworkScan obj which contains a callback which can be used to stop the scan.
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public NetworkScan requestNetworkScan(
- NetworkScanRequest request, TelephonyScanManager.NetworkScanCallback callback) {
+ NetworkScanRequest request, Executor executor,
+ TelephonyScanManager.NetworkScanCallback callback) {
synchronized (this) {
if (mTelephonyScanManager == null) {
mTelephonyScanManager = new TelephonyScanManager();
}
}
- return mTelephonyScanManager.requestNetworkScan(getSubId(), request, callback);
+ return mTelephonyScanManager.requestNetworkScan(getSubId(), request, executor, callback);
+ }
+
+ /**
+ * @deprecated
+ * Use {@link
+ * #requestNetworkScan(NetworkScanRequest, Executor, TelephonyScanManager.NetworkScanCallback)}
+ */
+ @Deprecated
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public NetworkScan requestNetworkScan(
+ NetworkScanRequest request, TelephonyScanManager.NetworkScanCallback callback) {
+ return requestNetworkScan(request, AsyncTask.THREAD_POOL_EXECUTOR, callback);
}
/**
@@ -7210,7 +7219,6 @@
}
} catch (RemoteException ex) {
// This could happen if binder process crashes.
- ex.rethrowAsRuntimeException();
}
return UNKNOWN_CARRIER_ID;
}
@@ -7235,7 +7243,6 @@
}
} catch (RemoteException ex) {
// This could happen if binder process crashes.
- ex.rethrowAsRuntimeException();
}
return null;
}
@@ -7759,7 +7766,6 @@
}
} catch (RemoteException ex) {
// This could happen if binder process crashes.
- ex.rethrowAsRuntimeException();
}
}
}
diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java
index c182e34..946cecf 100644
--- a/telephony/java/android/telephony/TelephonyScanManager.java
+++ b/telephony/java/android/telephony/TelephonyScanManager.java
@@ -33,6 +33,7 @@
import android.util.SparseArray;
import java.util.Arrays;
import java.util.List;
+import java.util.concurrent.Executor;
import com.android.internal.telephony.ITelephony;
@@ -55,8 +56,10 @@
/**
* The caller of
- * {@link TelephonyManager#requestNetworkScan(NetworkScanRequest, NetworkScanCallback)} should
- * implement and provide this callback so that the scan results or errors can be returned.
+ * {@link
+ * TelephonyManager#requestNetworkScan(NetworkScanRequest, Executor, NetworkScanCallback)}
+ * should implement and provide this callback so that the scan results or errors can be
+ * returned.
*/
public static abstract class NetworkScanCallback {
/** Returns the scan results to the user, this callback will be called multiple times. */
@@ -83,10 +86,13 @@
private static class NetworkScanInfo {
private final NetworkScanRequest mRequest;
+ private final Executor mExecutor;
private final NetworkScanCallback mCallback;
- NetworkScanInfo(NetworkScanRequest request, NetworkScanCallback callback) {
+ NetworkScanInfo(
+ NetworkScanRequest request, Executor executor, NetworkScanCallback callback) {
mRequest = request;
+ mExecutor = executor;
mCallback = callback;
}
}
@@ -112,10 +118,15 @@
"Failed to find NetworkScanInfo with id " + message.arg2);
}
NetworkScanCallback callback = nsi.mCallback;
+ Executor executor = nsi.mExecutor;
if (callback == null) {
throw new RuntimeException(
"Failed to find NetworkScanCallback with id " + message.arg2);
}
+ if (executor == null) {
+ throw new RuntimeException(
+ "Failed to find Executor with id " + message.arg2);
+ }
switch (message.what) {
case CALLBACK_SCAN_RESULTS:
@@ -126,21 +137,22 @@
for (int i = 0; i < parcelables.length; i++) {
ci[i] = (CellInfo) parcelables[i];
}
- callback.onResults((List<CellInfo>) Arrays.asList(ci));
+ executor.execute(() ->
+ callback.onResults((List<CellInfo>) Arrays.asList(ci)));
} catch (Exception e) {
Rlog.e(TAG, "Exception in networkscan callback onResults", e);
}
break;
case CALLBACK_SCAN_ERROR:
try {
- callback.onError(message.arg1);
+ executor.execute(() -> callback.onError(message.arg1));
} catch (Exception e) {
Rlog.e(TAG, "Exception in networkscan callback onError", e);
}
break;
case CALLBACK_SCAN_COMPLETE:
try {
- callback.onComplete();
+ executor.execute(() -> callback.onComplete());
mScanInfo.remove(message.arg2);
} catch (Exception e) {
Rlog.e(TAG, "Exception in networkscan callback onComplete", e);
@@ -171,12 +183,12 @@
* @hide
*/
public NetworkScan requestNetworkScan(int subId,
- NetworkScanRequest request, NetworkScanCallback callback) {
+ NetworkScanRequest request, Executor executor, NetworkScanCallback callback) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
int scanId = telephony.requestNetworkScan(subId, request, mMessenger, new Binder());
- saveScanInfo(scanId, request, callback);
+ saveScanInfo(scanId, request, executor, callback);
return new NetworkScan(scanId, subId);
}
} catch (RemoteException ex) {
@@ -187,9 +199,10 @@
return null;
}
- private void saveScanInfo(int id, NetworkScanRequest request, NetworkScanCallback callback) {
+ private void saveScanInfo(
+ int id, NetworkScanRequest request, Executor executor, NetworkScanCallback callback) {
synchronized (mScanInfo) {
- mScanInfo.put(id, new NetworkScanInfo(request, callback));
+ mScanInfo.put(id, new NetworkScanInfo(request, executor, callback));
}
}
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index 494ee65..f4b85b2 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -92,6 +92,7 @@
private static final int INITIAL_LAUNCH_IDLE_TIMEOUT = 5000; // 5s to allow app to idle
private static final int POST_LAUNCH_IDLE_TIMEOUT = 750; // 750ms idle for non initial launches
private static final int BETWEEN_LAUNCH_SLEEP_TIMEOUT = 5000; // 5s between launching apps
+ private static final int PROFILE_SAVE_SLEEP_TIMEOUT = 1000; // Allow 1s for the profile to save
private static final String LAUNCH_SUB_DIRECTORY = "launch_logs";
private static final String LAUNCH_FILE = "applaunch.txt";
private static final String TRACE_SUB_DIRECTORY = "atrace_logs";
@@ -263,6 +264,8 @@
String.format("killall -s SIGUSR1 %s", appPkgName);
getInstrumentation().getUiAutomation().executeShellCommand(
sendSignalCommand);
+ // killall is async, wait one second to let the app save the profile.
+ sleep(PROFILE_SAVE_SLEEP_TIMEOUT);
assertTrue(String.format("Not able to compile the app : %s", appPkgName),
compileApp(launch.getCompilerFilter(), appPkgName));
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index ddcf327..93fa598 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -2076,11 +2076,15 @@
}
/**
- * Set the {@link ProxyInfo} for this WifiConfiguration.
+ * Set the {@link ProxyInfo} for this WifiConfiguration. This method should only be used by a
+ * device owner or profile owner. When other apps attempt to save a {@link WifiConfiguration}
+ * with modified proxy settings, the methods {@link WifiManager#addNetwork} and
+ * {@link WifiManager#updateNetwork} fail and return {@code -1}.
+ *
* @param httpProxy {@link ProxyInfo} representing the httpProxy to be used by this
- * WifiConfiguration. Setting this {@code null} will explicitly set no proxy,
- * removing any proxy that was previously set.
- * @exception throw IllegalArgumentException for invalid httpProxy
+ * WifiConfiguration. Setting this to {@code null} will explicitly set no
+ * proxy, removing any proxy that was previously set.
+ * @exception IllegalArgumentException for invalid httpProxy
*/
public void setHttpProxy(ProxyInfo httpProxy) {
if (httpProxy == null) {