Merge "Loosen the constraint for releasing a shared file." into lmp-dev
diff --git a/api/current.txt b/api/current.txt
index 90d63b0..2cd1708 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27278,7 +27278,7 @@
method public boolean isSpeaking();
method public int playEarcon(java.lang.String, int, android.os.Bundle, java.lang.String);
method public deprecated int playEarcon(java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>);
- method public int playSilence(long, int, java.util.HashMap<java.lang.String, java.lang.String>, java.lang.String);
+ method public int playSilence(long, int, java.lang.String);
method public deprecated int playSilence(long, int, java.util.HashMap<java.lang.String, java.lang.String>);
method public int setAudioAttributes(android.media.AudioAttributes);
method public deprecated int setEngineByPackageName(java.lang.String);
@@ -27366,7 +27366,7 @@
public abstract class TextToSpeechService extends android.app.Service {
ctor public TextToSpeechService();
method public android.os.IBinder onBind(android.content.Intent);
- method protected java.lang.String onGetDefaultVoiceNameFor(java.lang.String, java.lang.String, java.lang.String);
+ method public java.lang.String onGetDefaultVoiceNameFor(java.lang.String, java.lang.String, java.lang.String);
method protected java.util.Set<java.lang.String> onGetFeaturesForLanguage(java.lang.String, java.lang.String, java.lang.String);
method protected abstract java.lang.String[] onGetLanguage();
method public java.util.List<android.speech.tts.Voice> onGetVoices();
@@ -27396,6 +27396,7 @@
method public int getQuality();
method public boolean isNetworkConnectionRequired();
method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator CREATOR;
field public static final int LATENCY_HIGH = 400; // 0x190
field public static final int LATENCY_LOW = 200; // 0xc8
field public static final int LATENCY_NORMAL = 300; // 0x12c
diff --git a/core/java/android/service/notification/ZenModeConfig.java b/core/java/android/service/notification/ZenModeConfig.java
index 9cbedab..882a3c8 100644
--- a/core/java/android/service/notification/ZenModeConfig.java
+++ b/core/java/android/service/notification/ZenModeConfig.java
@@ -61,6 +61,8 @@
private static final int MINUTES_MS = 60 * SECONDS_MS;
private static final int ZERO_VALUE_MS = 20 * SECONDS_MS;
+ private static final boolean DEFAULT_ALLOW_EVENTS = true;
+
private static final int XML_VERSION = 1;
private static final String ZEN_TAG = "zen";
private static final String ZEN_ATT_VERSION = "version";
@@ -68,6 +70,7 @@
private static final String ALLOW_ATT_CALLS = "calls";
private static final String ALLOW_ATT_MESSAGES = "messages";
private static final String ALLOW_ATT_FROM = "from";
+ private static final String ALLOW_ATT_EVENTS = "events";
private static final String SLEEP_TAG = "sleep";
private static final String SLEEP_ATT_MODE = "mode";
@@ -91,6 +94,7 @@
public boolean allowCalls;
public boolean allowMessages;
+ public boolean allowEvents = DEFAULT_ALLOW_EVENTS;
public int allowFrom = SOURCE_ANYONE;
public String sleepMode;
@@ -108,6 +112,7 @@
public ZenModeConfig(Parcel source) {
allowCalls = source.readInt() == 1;
allowMessages = source.readInt() == 1;
+ allowEvents = source.readInt() == 1;
if (source.readInt() == 1) {
sleepMode = source.readString();
}
@@ -134,6 +139,7 @@
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(allowCalls ? 1 : 0);
dest.writeInt(allowMessages ? 1 : 0);
+ dest.writeInt(allowEvents ? 1 : 0);
if (sleepMode != null) {
dest.writeInt(1);
dest.writeString(sleepMode);
@@ -167,6 +173,7 @@
.append("allowCalls=").append(allowCalls)
.append(",allowMessages=").append(allowMessages)
.append(",allowFrom=").append(sourceToString(allowFrom))
+ .append(",allowEvents=").append(allowEvents)
.append(",sleepMode=").append(sleepMode)
.append(",sleepStart=").append(sleepStartHour).append('.').append(sleepStartMinute)
.append(",sleepEnd=").append(sleepEndHour).append('.').append(sleepEndMinute)
@@ -200,6 +207,7 @@
return other.allowCalls == allowCalls
&& other.allowMessages == allowMessages
&& other.allowFrom == allowFrom
+ && other.allowEvents == allowEvents
&& Objects.equals(other.sleepMode, sleepMode)
&& other.sleepStartHour == sleepStartHour
&& other.sleepStartMinute == sleepStartMinute
@@ -213,7 +221,7 @@
@Override
public int hashCode() {
- return Objects.hash(allowCalls, allowMessages, allowFrom, sleepMode,
+ return Objects.hash(allowCalls, allowMessages, allowFrom, allowEvents, sleepMode,
sleepStartHour, sleepStartMinute, sleepEndHour, sleepEndMinute,
Arrays.hashCode(conditionComponents), Arrays.hashCode(conditionIds),
exitCondition, exitConditionComponent);
@@ -281,6 +289,7 @@
if (ALLOW_TAG.equals(tag)) {
rt.allowCalls = safeBoolean(parser, ALLOW_ATT_CALLS, false);
rt.allowMessages = safeBoolean(parser, ALLOW_ATT_MESSAGES, false);
+ rt.allowEvents = safeBoolean(parser, ALLOW_ATT_EVENTS, DEFAULT_ALLOW_EVENTS);
rt.allowFrom = safeInt(parser, ALLOW_ATT_FROM, SOURCE_ANYONE);
if (rt.allowFrom < SOURCE_ANYONE || rt.allowFrom > MAX_SOURCE) {
throw new IndexOutOfBoundsException("bad source in config:" + rt.allowFrom);
@@ -323,6 +332,7 @@
out.startTag(null, ALLOW_TAG);
out.attribute(null, ALLOW_ATT_CALLS, Boolean.toString(allowCalls));
out.attribute(null, ALLOW_ATT_MESSAGES, Boolean.toString(allowMessages));
+ out.attribute(null, ALLOW_ATT_EVENTS, Boolean.toString(allowEvents));
out.attribute(null, ALLOW_ATT_FROM, Integer.toString(allowFrom));
out.endTag(null, ALLOW_TAG);
diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index 9be220e..120c9e3 100644
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -1216,17 +1216,12 @@
*
* @param durationInMs The duration of the silence.
* @param queueMode {@link #QUEUE_ADD} or {@link #QUEUE_FLUSH}.
- * @param params Parameters for the request. Can be null.
- * Engine specific parameters may be passed in but the parameter keys
- * must be prefixed by the name of the engine they are intended for. For example
- * the keys "com.svox.pico_foo" and "com.svox.pico:bar" will be passed to the
- * engine named "com.svox.pico" if it is being used.
* @param utteranceId An unique identifier for this request.
*
* @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playSilence operation.
*/
public int playSilence(final long durationInMs, final int queueMode,
- final HashMap<String, String> params, final String utteranceId) {
+ final String utteranceId) {
return runAction(new Action<Integer>() {
@Override
public Integer run(ITextToSpeechService service) throws RemoteException {
@@ -1258,12 +1253,12 @@
*
* @return {@link #ERROR} or {@link #SUCCESS} of <b>queuing</b> the playSilence operation.
* @deprecated As of API level 20, replaced by
- * {@link #playSilence(long, int, HashMap, String)}.
+ * {@link #playSilence(long, int, String)}.
*/
@Deprecated
public int playSilence(final long durationInMs, final int queueMode,
final HashMap<String, String> params) {
- return playSilence(durationInMs, queueMode, params,
+ return playSilence(durationInMs, queueMode,
params == null ? null : params.get(Engine.KEY_PARAM_UTTERANCE_ID));
}
diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java
index d00a433..079467a 100644
--- a/core/java/android/speech/tts/TextToSpeechService.java
+++ b/core/java/android/speech/tts/TextToSpeechService.java
@@ -317,7 +317,7 @@
* @return A name of the default voice for a given locale.
*/
- protected String onGetDefaultVoiceNameFor(String lang, String country, String variant) {
+ public String onGetDefaultVoiceNameFor(String lang, String country, String variant) {
int localeStatus = onIsLanguageAvailable(lang, country, variant);
Locale iso3Locale = null;
switch (localeStatus) {
diff --git a/core/java/android/speech/tts/Voice.java b/core/java/android/speech/tts/Voice.java
index a1fa51d..dcf5980 100644
--- a/core/java/android/speech/tts/Voice.java
+++ b/core/java/android/speech/tts/Voice.java
@@ -91,9 +91,6 @@
Collections.addAll(this.mFeatures, in.readStringArray());
}
- /**
- * @hide
- */
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mName);
@@ -104,17 +101,11 @@
dest.writeStringList(new ArrayList<String>(mFeatures));
}
- /**
- * @hide
- */
@Override
public int describeContents() {
return 0;
}
- /**
- * @hide
- */
public static final Parcelable.Creator<Voice> CREATOR = new Parcelable.Creator<Voice>() {
@Override
public Voice createFromParcel(Parcel in) {
diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
index 8f8ce95..ac915d1 100644
--- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java
+++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java
@@ -16,6 +16,7 @@
package com.android.internal.inputmethod;
+import android.app.AppOpsManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -637,6 +638,25 @@
}
/**
+ * Returns true if a package name belongs to a UID.
+ *
+ * <p>This is a simple wrapper of {@link AppOpsManager#checkPackage(int, String)}.</p>
+ * @param appOpsManager the {@link AppOpsManager} object to be used for the validation.
+ * @param uid the UID to be validated.
+ * @param packageName the package name.
+ * @return {@code true} if the package name belongs to the UID.
+ */
+ public static boolean checkIfPackageBelongsToUid(final AppOpsManager appOpsManager,
+ final int uid, final String packageName) {
+ try {
+ appOpsManager.checkPackage(uid, packageName);
+ return true;
+ } catch (SecurityException e) {
+ return false;
+ }
+ }
+
+ /**
* Utility class for putting and getting settings for InputMethod
* TODO: Move all putters and getters of settings to this class.
*/
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 40c9ed2..4dde217 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -458,7 +458,7 @@
Log.v(TAG, "Preloading resource #" + Integer.toHexString(id));
}
if (id != 0) {
- if (mResources.getDrawable(id) == null) {
+ if (mResources.getDrawable(id, null) == null) {
throw new IllegalArgumentException(
"Unable to find preloaded drawable resource #0x"
+ Integer.toHexString(id)
diff --git a/core/res/res/drawable/ic_ab_back_material.xml b/core/res/res/drawable/ic_ab_back_material.xml
index 72d7981..e4bc6ccfb 100644
--- a/core/res/res/drawable/ic_ab_back_material.xml
+++ b/core/res/res/drawable/ic_ab_back_material.xml
@@ -21,6 +21,6 @@
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M20.000000,11.000000L7.800000,11.000000l5.600000,-5.600000L12.000000,4.000000l-8.000000,8.000000l8.000000,8.000000l1.400000,-1.400000L7.800000,13.000000L20.000000,13.000000L20.000000,11.000000z"
+ android:pathData="M20,11L7.8,11l5.6,-5.6L12,4l-8,8l8,8l1.4,-1.4L7.8,13L20,13L20,11z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_dialog_alert_material.xml b/core/res/res/drawable/ic_dialog_alert_material.xml
index 3bb4d2c..26daea7 100644
--- a/core/res/res/drawable/ic_dialog_alert_material.xml
+++ b/core/res/res/drawable/ic_dialog_alert_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M1.000000,21.000000l22.000000,0.000000L12.000000,2.000000L1.000000,21.000000zM13.000000,18.000000l-2.000000,0.000000l0.000000,-2.000000l2.000000,0.000000L13.000000,18.000000zM13.000000,14.000000l-2.000000,0.000000l0.000000,-4.000000l2.000000,0.000000L13.000000,14.000000z"
+ android:pathData="M1,21l22,0L12,2L1,21zM13,18l-2,0l0,-2l2,0L13,18zM13,14l-2,0l0,-4l2,0L13,14z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_go_search_api_material.xml b/core/res/res/drawable/ic_go_search_api_material.xml
index 21c7249..67ef281 100644
--- a/core/res/res/drawable/ic_go_search_api_material.xml
+++ b/core/res/res/drawable/ic_go_search_api_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M10.000000,6.000000l-1.400000,1.400000 4.599999,4.600000 -4.599999,4.600000 1.400000,1.400000 6.000000,-6.000000z"
+ android:pathData="M10,6l-1.4,1.4 4.599999,4.6 -4.599999,4.6 1.4,1.4 6,-6z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_copy_material.xml b/core/res/res/drawable/ic_menu_copy_material.xml
index da3912b..c03723b 100644
--- a/core/res/res/drawable/ic_menu_copy_material.xml
+++ b/core/res/res/drawable/ic_menu_copy_material.xml
@@ -21,6 +21,6 @@
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M16.000000,1.000000L4.000000,1.000000C2.900000,1.000000 2.000000,1.900000 2.000000,3.000000l0.000000,14.000000l2.000000,0.000000L4.000000,3.000000l12.000000,0.000000L16.000000,1.000000zM19.000000,5.000000L8.000000,5.000000C6.900000,5.000000 6.000000,5.900000 6.000000,7.000000l0.000000,14.000000c0.000000,1.100000 0.900000,2.000000 2.000000,2.000000l11.000000,0.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000L21.000000,7.000000C21.000000,5.900000 20.100000,5.000000 19.000000,5.000000zM19.000000,21.000000L8.000000,21.000000L8.000000,7.000000l11.000000,0.000000L19.000000,21.000000z"
+ android:pathData="M16,1L4,1C2.9,1 2,1.9 2,3l0,14l2,0L4,3l12,0L16,1zM19,5L8,5C6.9,5 6,5.9 6,7l0,14c0,1.1 0.9,2 2,2l11,0c1.1,0 2,-0.9 2,-2L21,7C21,5.9 20.1,5 19,5zM19,21L8,21L8,7l11,0L19,21z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_cut_material.xml b/core/res/res/drawable/ic_menu_cut_material.xml
index 54db72a..aec6685 100644
--- a/core/res/res/drawable/ic_menu_cut_material.xml
+++ b/core/res/res/drawable/ic_menu_cut_material.xml
@@ -21,6 +21,6 @@
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M10.000000,6.000000c0.000000,-2.200000 -1.800000,-4.000000 -4.000000,-4.000000S2.000000,3.800000 2.000000,6.000000c0.000000,2.200000 1.800000,4.000000 4.000000,4.000000c0.600000,0.000000 1.100000,-0.100000 1.600000,-0.400000L10.000000,12.000000l-2.400000,2.400000C7.100000,14.100000 6.600000,14.000000 6.000000,14.000000c-2.200000,0.000000 -4.000000,1.800000 -4.000000,4.000000c0.000000,2.200000 1.800000,4.000000 4.000000,4.000000s4.000000,-1.800000 4.000000,-4.000000c0.000000,-0.600000 -0.100000,-1.100000 -0.400000,-1.600000L12.000000,14.000000l7.000000,7.000000l4.000000,0.000000L9.600000,7.600000C9.900000,7.100000 10.000000,6.600000 10.000000,6.000000zM6.000000,8.000000C4.900000,8.000000 4.000000,7.100000 4.000000,6.000000s0.900000,-2.000000 2.000000,-2.000000c1.100000,0.000000 2.000000,0.900000 2.000000,2.000000S7.100000,8.000000 6.000000,8.000000zM6.000000,20.000000c-1.100000,0.000000 -2.000000,-0.900000 -2.000000,-2.000000s0.900000,-2.000000 2.000000,-2.000000c1.100000,0.000000 2.000000,0.900000 2.000000,2.000000S7.100000,20.000000 6.000000,20.000000zM12.000000,11.500000c0.300000,0.000000 0.500000,0.200000 0.500000,0.500000c0.000000,0.300000 -0.200000,0.500000 -0.500000,0.500000c-0.300000,0.000000 -0.500000,-0.200000 -0.500000,-0.500000C11.500000,11.700000 11.700000,11.500000 12.000000,11.500000zM23.000000,3.000000l-4.000000,0.000000l-6.000000,6.000000l2.000000,2.000000L23.000000,3.000000z"
+ android:pathData="M10,6c0,-2.2 -1.8,-4 -4,-4S2,3.8 2,6c0,2.2 1.8,4 4,4c0.6,0 1.1,-0.1 1.6,-0.4L10,12l-2.4,2.4C7.1,14.1 6.6,14 6,14c-2.2,0 -4,1.8 -4,4c0,2.2 1.8,4 4,4s4,-1.8 4,-4c0,-0.6 -0.1,-1.1 -0.4,-1.6L12,14l7,7l4,0L9.6,7.6C9.9,7.1 10,6.6 10,6zM6,8C4.9,8 4,7.1 4,6s0.9,-2 2,-2c1.1,0 2,0.9 2,2S7.1,8 6,8zM6,20c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2c1.1,0 2,0.9 2,2S7.1,20 6,20zM12,11.5c0.3,0 0.5,0.2 0.5,0.5c0,0.3 -0.2,0.5 -0.5,0.5c-0.3,0 -0.5,-0.2 -0.5,-0.5C11.5,11.7 11.7,11.5 12,11.5zM23,3l-4,0l-6,6l2,2L23,3z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_moreoverflow_material.xml b/core/res/res/drawable/ic_menu_moreoverflow_material.xml
index c128570..502ad69 100644
--- a/core/res/res/drawable/ic_menu_moreoverflow_material.xml
+++ b/core/res/res/drawable/ic_menu_moreoverflow_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M12.000000,8.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000s-0.900000,-2.000000 -2.000000,-2.000000c-1.100000,0.000000 -2.000000,0.900000 -2.000000,2.000000S10.900000,8.000000 12.000000,8.000000zM12.000000,10.000000c-1.100000,0.000000 -2.000000,0.900000 -2.000000,2.000000s0.900000,2.000000 2.000000,2.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000S13.100000,10.000000 12.000000,10.000000zM12.000000,16.000000c-1.100000,0.000000 -2.000000,0.900000 -2.000000,2.000000s0.900000,2.000000 2.000000,2.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000S13.100000,16.000000 12.000000,16.000000z"
+ android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2c-1.1,0 -2,0.9 -2,2S10.9,8 12,8zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2c1.1,0 2,-0.9 2,-2S13.1,10 12,10zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2c1.1,0 2,-0.9 2,-2S13.1,16 12,16z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_paste_material.xml b/core/res/res/drawable/ic_menu_paste_material.xml
index 5f847cb..ee24267 100644
--- a/core/res/res/drawable/ic_menu_paste_material.xml
+++ b/core/res/res/drawable/ic_menu_paste_material.xml
@@ -21,6 +21,6 @@
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M19.000000,2.000000l-4.200000,0.000000c-0.400000,-1.200000 -1.500000,-2.000000 -2.800000,-2.000000c-1.300000,0.000000 -2.400000,0.800000 -2.800000,2.000000L5.000000,2.000000C3.900000,2.000000 3.000000,2.900000 3.000000,4.000000l0.000000,16.000000c0.000000,1.100000 0.900000,2.000000 2.000000,2.000000l14.000000,0.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000L21.000000,4.000000C21.000000,2.900000 20.100000,2.000000 19.000000,2.000000zM12.000000,2.000000c0.600000,0.000000 1.000000,0.400000 1.000000,1.000000s-0.400000,1.000000 -1.000000,1.000000c-0.600000,0.000000 -1.000000,-0.400000 -1.000000,-1.000000S11.400000,2.000000 12.000000,2.000000zM19.000000,20.000000L5.000000,20.000000L5.000000,4.000000l2.000000,0.000000l0.000000,3.000000l10.000000,0.000000L17.000000,4.000000l2.000000,0.000000L19.000000,20.000000z"
+ android:pathData="M19,2l-4.2,0c-0.4,-1.2 -1.5,-2 -2.8,-2c-1.3,0 -2.4,0.8 -2.8,2L5,2C3.9,2 3,2.9 3,4l0,16c0,1.1 0.9,2 2,2l14,0c1.1,0 2,-0.9 2,-2L21,4C21,2.9 20.1,2 19,2zM12,2c0.6,0 1,0.4 1,1s-0.4,1 -1,1c-0.6,0 -1,-0.4 -1,-1S11.4,2 12,2zM19,20L5,20L5,4l2,0l0,3l10,0L17,4l2,0L19,20z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_selectall_material.xml b/core/res/res/drawable/ic_menu_selectall_material.xml
index 11e63fd..fd05c72 100644
--- a/core/res/res/drawable/ic_menu_selectall_material.xml
+++ b/core/res/res/drawable/ic_menu_selectall_material.xml
@@ -21,6 +21,6 @@
android:autoMirrored="true"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M3.000000,5.000000l2.000000,0.000000L5.000000,3.000000C3.900000,3.000000 3.000000,3.900000 3.000000,5.000000zM3.000000,13.000000l2.000000,0.000000l0.000000,-2.000000L3.000000,11.000000L3.000000,13.000000zM7.000000,21.000000l2.000000,0.000000l0.000000,-2.000000L7.000000,19.000000L7.000000,21.000000zM3.000000,9.000000l2.000000,0.000000L5.000000,7.000000L3.000000,7.000000L3.000000,9.000000zM13.000000,3.000000l-2.000000,0.000000l0.000000,2.000000l2.000000,0.000000L13.000000,3.000000zM19.000000,3.000000l0.000000,2.000000l2.000000,0.000000C21.000000,3.900000 20.100000,3.000000 19.000000,3.000000zM5.000000,21.000000l0.000000,-2.000000L3.000000,19.000000C3.000000,20.100000 3.900000,21.000000 5.000000,21.000000zM3.000000,17.000000l2.000000,0.000000l0.000000,-2.000000L3.000000,15.000000L3.000000,17.000000zM9.000000,3.000000L7.000000,3.000000l0.000000,2.000000l2.000000,0.000000L9.000000,3.000000zM11.000000,21.000000l2.000000,0.000000l0.000000,-2.000000l-2.000000,0.000000L11.000000,21.000000zM19.000000,13.000000l2.000000,0.000000l0.000000,-2.000000l-2.000000,0.000000L19.000000,13.000000zM19.000000,21.000000c1.100000,0.000000 2.000000,-0.900000 2.000000,-2.000000l-2.000000,0.000000L19.000000,21.000000zM19.000000,9.000000l2.000000,0.000000L21.000000,7.000000l-2.000000,0.000000L19.000000,9.000000zM19.000000,17.000000l2.000000,0.000000l0.000000,-2.000000l-2.000000,0.000000L19.000000,17.000000zM15.000000,21.000000l2.000000,0.000000l0.000000,-2.000000l-2.000000,0.000000L15.000000,21.000000zM15.000000,5.000000l2.000000,0.000000L17.000000,3.000000l-2.000000,0.000000L15.000000,5.000000zM7.000000,17.000000l10.000000,0.000000L17.000000,7.000000L7.000000,7.000000L7.000000,17.000000zM9.000000,9.000000l6.000000,0.000000l0.000000,6.000000L9.000000,15.000000L9.000000,9.000000z"
+ android:pathData="M3,5l2,0L5,3C3.9,3 3,3.9 3,5zM3,13l2,0l0,-2L3,11L3,13zM7,21l2,0l0,-2L7,19L7,21zM3,9l2,0L5,7L3,7L3,9zM13,3l-2,0l0,2l2,0L13,3zM19,3l0,2l2,0C21,3.9 20.1,3 19,3zM5,21l0,-2L3,19C3,20.1 3.9,21 5,21zM3,17l2,0l0,-2L3,15L3,17zM9,3L7,3l0,2l2,0L9,3zM11,21l2,0l0,-2l-2,0L11,21zM19,13l2,0l0,-2l-2,0L19,13zM19,21c1.1,0 2,-0.9 2,-2l-2,0L19,21zM19,9l2,0L21,7l-2,0L19,9zM19,17l2,0l0,-2l-2,0L19,17zM15,21l2,0l0,-2l-2,0L15,21zM15,5l2,0L17,3l-2,0L15,5zM7,17l10,0L17,7L7,7L7,17zM9,9l6,0l0,6L9,15L9,9z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_menu_share_material.xml b/core/res/res/drawable/ic_menu_share_material.xml
index b7c238f..6c351c9 100644
--- a/core/res/res/drawable/ic_menu_share_material.xml
+++ b/core/res/res/drawable/ic_menu_share_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M18.000000,16.100000c-0.800000,0.000000 -1.500000,0.300000 -2.000000,0.800000l-7.100000,-4.200000C9.000000,12.500000 9.000000,12.200000 9.000000,12.000000s0.000000,-0.500000 -0.100000,-0.700000L16.000000,7.200000C16.500000,7.700000 17.200001,8.000000 18.000000,8.000000c1.700000,0.000000 3.000000,-1.300000 3.000000,-3.000000s-1.300000,-3.000000 -3.000000,-3.000000s-3.000000,1.300000 -3.000000,3.000000c0.000000,0.200000 0.000000,0.500000 0.100000,0.700000L8.000000,9.800000C7.500000,9.300000 6.800000,9.000000 6.000000,9.000000c-1.700000,0.000000 -2.900000,1.200000 -2.900000,2.900000s1.300000,3.000000 3.000000,3.000000c0.800000,0.000000 1.500000,-0.300000 2.000000,-0.800000l7.100000,4.200000c-0.100000,0.300000 -0.100000,0.500000 -0.100000,0.700000c0.000000,1.600000 1.300000,2.900000 2.900000,2.900000s2.900000,-1.300000 2.900000,-2.900000S19.600000,16.100000 18.000000,16.100000z"
+ android:pathData="M18,16.1c-0.8,0 -1.5,0.3 -2,0.8l-7.1,-4.2C9,12.5 9,12.2 9,12s0,-0.5 -0.1,-0.7L16,7.2C16.5,7.7 17.200001,8 18,8c1.7,0 3,-1.3 3,-3s-1.3,-3 -3,-3s-3,1.3 -3,3c0,0.2 0,0.5 0.1,0.7L8,9.8C7.5,9.3 6.8,9 6,9c-1.7,0 -2.9,1.2 -2.9,2.9s1.3,3 3,3c0.8,0 1.5,-0.3 2,-0.8l7.1,4.2c-0.1,0.3 -0.1,0.5 -0.1,0.7c0,1.6 1.3,2.9 2.9,2.9s2.9,-1.3 2.9,-2.9S19.6,16.1 18,16.1z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_search_api_material.xml b/core/res/res/drawable/ic_search_api_material.xml
index ac1aae3..70367bd 100644
--- a/core/res/res/drawable/ic_search_api_material.xml
+++ b/core/res/res/drawable/ic_search_api_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M15.500000,14.000000l-0.800000,0.000000l-0.300000,-0.300000c1.000000,-1.100000 1.600000,-2.600000 1.600000,-4.200000C16.000000,5.900000 13.100000,3.000000 9.500000,3.000000C5.900000,3.000000 3.000000,5.900000 3.000000,9.500000S5.900000,16.000000 9.500000,16.000000c1.600000,0.000000 3.100000,-0.600000 4.200000,-1.600000l0.300000,0.300000l0.000000,0.800000l5.000000,5.000000l1.500000,-1.500000L15.500000,14.000000zM9.500000,14.000000C7.000000,14.000000 5.000000,12.000000 5.000000,9.500000S7.000000,5.000000 9.500000,5.000000C12.000000,5.000000 14.000000,7.000000 14.000000,9.500000S12.000000,14.000000 9.500000,14.000000z"
+ android:pathData="M15.5,14l-0.8,0l-0.3,-0.3c1,-1.1 1.6,-2.6 1.6,-4.2C16,5.9 13.1,3 9.5,3C5.9,3 3,5.9 3,9.5S5.9,16 9.5,16c1.6,0 3.1,-0.6 4.2,-1.6l0.3,0.3l0,0.8l5,5l1.5,-1.5L15.5,14zM9.5,14C7,14 5,12 5,9.5S7,5 9.5,5C12,5 14,7 14,9.5S12,14 9.5,14z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/ic_voice_search_api_material.xml b/core/res/res/drawable/ic_voice_search_api_material.xml
index 8c1e803..a026218 100644
--- a/core/res/res/drawable/ic_voice_search_api_material.xml
+++ b/core/res/res/drawable/ic_voice_search_api_material.xml
@@ -20,6 +20,6 @@
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
- android:pathData="M12.000000,14.000000c1.700000,0.000000 3.000000,-1.300000 3.000000,-3.000000l0.000000,-6.000000c0.000000,-1.700000 -1.300000,-3.000000 -3.000000,-3.000000c-1.700000,0.000000 -3.000000,1.300000 -3.000000,3.000000l0.000000,6.000000C9.000000,12.700000 10.300000,14.000000 12.000000,14.000000zM17.299999,11.000000c0.000000,3.000000 -2.500000,5.100000 -5.300000,5.100000c-2.800000,0.000000 -5.300000,-2.100000 -5.300000,-5.100000L5.000000,11.000000c0.000000,3.400000 2.700000,6.200000 6.000000,6.700000L11.000000,21.000000l2.000000,0.000000l0.000000,-3.300000c3.300000,-0.500000 6.000000,-3.300000 6.000000,-6.700000L17.299999,11.000001z"
+ android:pathData="M12,14c1.7,0 3,-1.3 3,-3l0,-6c0,-1.7 -1.3,-3 -3,-3c-1.7,0 -3,1.3 -3,3l0,6C9,12.7 10.3,14 12,14zM17.299999,11c0,3 -2.5,5.1 -5.3,5.1c-2.8,0 -5.3,-2.1 -5.3,-5.1L5,11c0,3.4 2.7,6.2 6,6.7L11,21l2,0l0,-3.3c3.3,-0.5 6,-3.3 6,-6.7L17.299999,11.000001z"
android:fillColor="@color/white"/>
</vector>
diff --git a/core/res/res/drawable/stat_notify_disabled_data.xml b/core/res/res/drawable/stat_notify_disabled_data.xml
index 9089d08..4f6ea7f 100644
--- a/core/res/res/drawable/stat_notify_disabled_data.xml
+++ b/core/res/res/drawable/stat_notify_disabled_data.xml
@@ -20,5 +20,5 @@
android:viewportHeight="48.0">
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M26.000000,4.100000l0.000000,6.100000c6.800000,1.000000 12.000000,6.800000 12.000000,13.800000c0.000000,1.800000 -0.400000,3.500000 -1.000000,5.100000l5.200000,3.100000c1.100000,-2.500000 1.800000,-5.200000 1.800000,-8.100000C44.000000,13.600000 36.099998,5.100000 26.000000,4.100000zM24.000000,38.000000c-7.700000,0.000000 -14.000000,-6.300000 -14.000000,-14.000000c0.000000,-7.100000 5.200000,-12.900000 12.000000,-13.800000L22.000000,4.100000C11.900000,5.100000 4.000000,13.600000 4.000000,24.000000c0.000000,11.000000 8.900000,20.000000 20.000000,20.000000c6.600000,0.000000 12.500000,-3.200000 16.100000,-8.200000l-5.200000,-3.100000C32.299999,36.000000 28.400000,38.000000 24.000000,38.000000z"/>
+ android:pathData="M26,4.1l0,6.1c6.8,1 12,6.8 12,13.8c0,1.8 -0.4,3.5 -1,5.1l5.2,3.1c1.1,-2.5 1.8,-5.2 1.8,-8.1C44,13.6 36.099998,5.1 26,4.1zM24,38c-7.7,0 -14,-6.3 -14,-14c0,-7.1 5.2,-12.9 12,-13.8L22,4.1C11.9,5.1 4,13.6 4,24c0,11 8.9,20 20,20c6.6,0 12.5,-3.2 16.1,-8.2l-5.2,-3.1C32.299999,36 28.4,38 24,38z"/>
</vector>
diff --git a/core/res/res/drawable/stat_notify_wifi_in_range.xml b/core/res/res/drawable/stat_notify_wifi_in_range.xml
index 9a5407d..a271ca5 100644
--- a/core/res/res/drawable/stat_notify_wifi_in_range.xml
+++ b/core/res/res/drawable/stat_notify_wifi_in_range.xml
@@ -20,8 +20,8 @@
android:viewportHeight="24.0">
<path
android:fillColor="#4DFFFFFF"
- android:pathData="M19.100000,14.000000l-3.400000,0.000000l0.000000,-1.500000c0.000000,-1.800000 0.800000,-2.800000 1.500000,-3.400000C18.100000,8.300000 19.200001,8.000000 20.600000,8.000000c1.200000,0.000000 2.300000,0.300000 3.100000,0.800000l1.900000,-2.300000C25.100000,6.100000 20.299999,2.100000 13.000000,2.100000S0.900000,6.100000 0.400000,6.500000L13.000000,22.000000l0.000000,0.000000l0.000000,0.000000l0.000000,0.000000l0.000000,0.000000l6.500000,-8.100000L19.100000,14.000000z"/>
+ android:pathData="M19.1,14l-3.4,0l0,-1.5c0,-1.8 0.8,-2.8 1.5,-3.4C18.1,8.3 19.200001,8 20.6,8c1.2,0 2.3,0.3 3.1,0.8l1.9,-2.3C25.1,6.1 20.299999,2.1 13,2.1S0.9,6.1 0.4,6.5L13,22l0,0l0,0l0,0l0,0l6.5,-8.1L19.1,14z"/>
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M19.500000,17.799999c0.000000,-0.800000 0.100000,-1.300000 0.200000,-1.600000c0.200000,-0.300000 0.500000,-0.700000 1.100000,-1.200000c0.400000,-0.400000 0.700000,-0.800000 1.000000,-1.100000s0.400000,-0.800000 0.400000,-1.200000c0.000000,-0.500000 -0.100000,-0.900000 -0.400000,-1.200000c-0.300000,-0.300000 -0.700000,-0.400000 -1.200000,-0.400000c-0.400000,0.000000 -0.800000,0.100000 -1.100000,0.300000c-0.300000,0.200000 -0.400000,0.600000 -0.400000,1.100000l-1.900000,0.000000c0.000000,-1.000000 0.300000,-1.700000 1.000000,-2.200000c0.600000,-0.500000 1.500000,-0.800000 2.500000,-0.800000c1.100000,0.000000 2.000000,0.300000 2.600000,0.800000c0.600000,0.500000 0.900000,1.300000 0.900000,2.300000c0.000000,0.700000 -0.200000,1.300000 -0.600000,1.800000c-0.400000,0.600000 -0.900000,1.100000 -1.500000,1.600000c-0.300000,0.300000 -0.500000,0.500000 -0.600000,0.700000c-0.100000,0.200000 -0.100000,0.600000 -0.100000,1.000000L19.500000,17.700001zM21.400000,21.000000l-1.900000,0.000000l0.000000,-1.800000l1.900000,0.000000L21.400000,21.000000z"/>
+ android:pathData="M19.5,17.799999c0,-0.8 0.1,-1.3 0.2,-1.6c0.2,-0.3 0.5,-0.7 1.1,-1.2c0.4,-0.4 0.7,-0.8 1,-1.1s0.4,-0.8 0.4,-1.2c0,-0.5 -0.1,-0.9 -0.4,-1.2c-0.3,-0.3 -0.7,-0.4 -1.2,-0.4c-0.4,0 -0.8,0.1 -1.1,0.3c-0.3,0.2 -0.4,0.6 -0.4,1.1l-1.9,0c0,-1 0.3,-1.7 1,-2.2c0.6,-0.5 1.5,-0.8 2.5,-0.8c1.1,0 2,0.3 2.6,0.8c0.6,0.5 0.9,1.3 0.9,2.3c0,0.7 -0.2,1.3 -0.6,1.8c-0.4,0.6 -0.9,1.1 -1.5,1.6c-0.3,0.3 -0.5,0.5 -0.6,0.7c-0.1,0.2 -0.1,0.6 -0.1,1L19.5,17.700001zM21.4,21l-1.9,0l0,-1.8l1.9,0L21.4,21z"/>
</vector>
diff --git a/core/res/res/drawable/stat_sys_tether_wifi.xml b/core/res/res/drawable/stat_sys_tether_wifi.xml
index 4396962..23dc849 100644
--- a/core/res/res/drawable/stat_sys_tether_wifi.xml
+++ b/core/res/res/drawable/stat_sys_tether_wifi.xml
@@ -21,5 +21,5 @@
<path
android:fillColor="#FFFFFFFF"
- android:pathData="M24.000000,22.000000c-2.200000,0.000000 -4.000000,1.800000 -4.000000,4.000000c0.000000,2.200000 1.800000,4.000000 4.000000,4.000000c2.200000,0.000000 4.000000,-1.800000 4.000000,-4.000000C28.000000,23.799999 26.200001,22.000000 24.000000,22.000000zM36.000000,26.000000c0.000000,-6.600000 -5.400000,-12.000000 -12.000000,-12.000000c-6.600000,0.000000 -12.000000,5.400000 -12.000000,12.000000c0.000000,4.400000 2.400000,8.300000 6.000000,10.400000l2.000000,-3.500000c-2.400000,-1.400000 -4.000000,-3.900000 -4.000000,-6.900000c0.000000,-4.400000 3.600000,-8.000000 8.000000,-8.000000s8.000000,3.600000 8.000000,8.000000c0.000000,3.000000 -1.600000,5.500000 -4.000000,6.900000l2.000000,3.500000C33.599998,34.299999 36.000000,30.400000 36.000000,26.000000zM24.000000,6.000000C13.000000,6.000000 4.000000,15.000000 4.000000,26.000000c0.000000,7.400000 4.000000,13.800000 10.000000,17.299999l2.000000,-3.500000c-4.800000,-2.800000 -8.000000,-7.900000 -8.000000,-13.800000c0.000000,-8.800000 7.200000,-16.000000 16.000000,-16.000000s16.000000,7.200000 16.000000,16.000000c0.000000,5.900000 -3.200000,11.100000 -8.000000,13.800000l2.000000,3.500000c6.000000,-3.500000 10.000000,-9.900000 10.000000,-17.299999C44.000000,15.000000 35.000000,6.000000 24.000000,6.000000z"/>
+ android:pathData="M24,22c-2.2,0 -4,1.8 -4,4c0,2.2 1.8,4 4,4c2.2,0 4,-1.8 4,-4C28,23.799999 26.200001,22 24,22zM36,26c0,-6.6 -5.4,-12 -12,-12c-6.6,0 -12,5.4 -12,12c0,4.4 2.4,8.3 6,10.4l2,-3.5c-2.4,-1.4 -4,-3.9 -4,-6.9c0,-4.4 3.6,-8 8,-8s8,3.6 8,8c0,3 -1.6,5.5 -4,6.9l2,3.5C33.599998,34.299999 36,30.4 36,26zM24,6C13,6 4,15 4,26c0,7.4 4,13.8 10,17.299999l2,-3.5c-4.8,-2.8 -8,-7.9 -8,-13.8c0,-8.8 7.2,-16 16,-16s16,7.2 16,16c0,5.9 -3.2,11.1 -8,13.8l2,3.5c6,-3.5 10,-9.9 10,-17.299999C44,15 35,6 24,6z"/>
</vector>
diff --git a/packages/SystemUI/res/layout/zen_mode_panel.xml b/packages/SystemUI/res/layout/zen_mode_panel.xml
index bfeac9d..d0fba20 100644
--- a/packages/SystemUI/res/layout/zen_mode_panel.xml
+++ b/packages/SystemUI/res/layout/zen_mode_panel.xml
@@ -76,7 +76,7 @@
android:layout_alignParentEnd="true"
android:background="@drawable/btn_borderless_rect"
android:clickable="true"
- android:contentDescription="@null"
+ android:contentDescription="@string/accessibility_desc_settings"
android:scaleType="center"
android:src="@drawable/ic_settings" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 90be92d..5353f25 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -148,7 +148,7 @@
if (!mDozing || mPulseCallback != null) {
// Pulse suppressed.
- mPulseCallback.onPulseFinished();
+ callback.onPulseFinished();
return;
}
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
index d05de69..86cfdb9 100644
--- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
+++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
@@ -434,6 +434,8 @@
}
}
+ clearProvidersAndHostsTagsLocked();
+
loadGroupWidgetProvidersLocked(newProfileIds);
loadGroupStateLocked(newProfileIds);
}
@@ -2372,6 +2374,20 @@
}
}
+ private void clearProvidersAndHostsTagsLocked() {
+ final int providerCount = mProviders.size();
+ for (int i = 0; i < providerCount; i++) {
+ Provider provider = mProviders.get(i);
+ provider.tag = TAG_UNDEFINED;
+ }
+
+ final int hostCount = mHosts.size();
+ for (int i = 0; i < hostCount; i++) {
+ Host host = mHosts.get(i);
+ host.tag = TAG_UNDEFINED;
+ }
+ }
+
private boolean writeProfileStateToFileLocked(FileOutputStream stream, int userId) {
int N;
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index 060c8e3..1623eac 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -40,6 +40,7 @@
import android.app.ActivityManagerNative;
import android.app.AppGlobals;
import android.app.AlertDialog;
+import android.app.AppOpsManager;
import android.app.IUserSwitchObserver;
import android.app.KeyguardManager;
import android.app.Notification;
@@ -175,6 +176,7 @@
private InputMethodFileManager mFileManager;
private final HardKeyboardListener mHardKeyboardListener;
private final WindowManagerService mWindowManagerService;
+ private final AppOpsManager mAppOpsManager;
final InputBindResult mNoBinding = new InputBindResult(null, null, null, -1, -1);
@@ -643,6 +645,7 @@
}
}, true /*asyncHandler*/);
mWindowManagerService = windowManager;
+ mAppOpsManager = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
mHardKeyboardListener = new HardKeyboardListener();
mHasFeature = context.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_INPUT_METHODS);
@@ -1746,6 +1749,20 @@
throw new IllegalArgumentException("Unknown id: " + id);
}
+ if (mCurClient != null && mCurAttribute != null) {
+ final int uid = mCurClient.uid;
+ final String packageName = mCurAttribute.packageName;
+ if (SystemConfig.getInstance().getFixedImeApps().contains(packageName)) {
+ if (InputMethodUtils.checkIfPackageBelongsToUid(mAppOpsManager, uid, packageName)) {
+ return;
+ }
+ // TODO: Do we need to lock the input method when the application reported an
+ // incorrect package name?
+ Slog.e(TAG, "Ignoring FixedImeApps due to the validation failure. uid=" + uid
+ + " package=" + packageName);
+ }
+ }
+
// See if we need to notify a subtype change within the same IME.
if (id.equals(mCurMethodId)) {
final int subtypeCount = info.getSubtypeCount();
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 9228fc6..9509789 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -2623,6 +2623,11 @@
final void removeLruProcessLocked(ProcessRecord app) {
int lrui = mLruProcesses.lastIndexOf(app);
if (lrui >= 0) {
+ if (!app.killed) {
+ Slog.wtf(TAG, "Removing process that hasn't been killed: " + app);
+ Process.killProcessQuiet(app.pid);
+ Process.killProcessGroup(app.info.uid, app.pid);
+ }
if (lrui <= mLruProcessActivityStart) {
mLruProcessActivityStart--;
}
@@ -3206,6 +3211,7 @@
app.setPid(startResult.pid);
app.usingWrapper = startResult.usingWrapper;
app.removed = false;
+ app.killed = false;
app.killedByAm = false;
checkTime(startTime, "startProcess: starting to update pids map");
synchronized (mPidsSelfLocked) {
@@ -4804,15 +4810,16 @@
appDiedLocked(app, app.pid, app.thread);
}
- final void appDiedLocked(ProcessRecord app, int pid,
- IApplicationThread thread) {
+ final void appDiedLocked(ProcessRecord app, int pid, IApplicationThread thread) {
BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics();
synchronized (stats) {
stats.noteProcessDiedLocked(app.info.uid, pid);
}
+ Process.killProcessQuiet(pid);
Process.killProcessGroup(app.info.uid, pid);
+ app.killed = true;
// Clean up already done if the process has been re-started.
if (app.pid == pid && app.thread != null &&
diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java
index 0817dd8..7c48f3e 100644
--- a/services/core/java/com/android/server/am/ProcessRecord.java
+++ b/services/core/java/com/android/server/am/ProcessRecord.java
@@ -100,6 +100,7 @@
boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY
boolean bad; // True if disabled in the bad process list
boolean killedByAm; // True when proc has been killed by activity manager, not for RAM
+ boolean killed; // True once we know the process has been killed
boolean procStateChanged; // Keep track of whether we changed 'setAdj'.
String waitingToKill; // Process is waiting to be killed when in the bg, and reason
IBinder forcingToForeground;// Token that is forcing this process to be foreground
@@ -303,8 +304,9 @@
pw.print(" lastLowMemory=");
TimeUtils.formatDuration(lastLowMemory, now, pw);
pw.print(" reportLowMemory="); pw.println(reportLowMemory);
- if (killedByAm || waitingToKill != null) {
- pw.print(prefix); pw.print("killedByAm="); pw.print(killedByAm);
+ if (killed || killedByAm || waitingToKill != null) {
+ pw.print(prefix); pw.print("killed="); pw.print(killed);
+ pw.print(" killedByAm="); pw.print(killedByAm);
pw.print(" waitingToKill="); pw.println(waitingToKill);
}
if (debugging || crashing || crashDialog != null || notResponding
@@ -514,6 +516,7 @@
Process.killProcessQuiet(pid);
Process.killProcessGroup(info.uid, pid);
if (!persistent) {
+ killed = true;
killedByAm = true;
}
}
diff --git a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
index 8a1f3ad..cdfb656 100644
--- a/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
+++ b/services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.display.DisplayManager;
+import android.media.MediaRouter;
import android.media.projection.IMediaProjectionManager;
import android.media.projection.IMediaProjection;
import android.media.projection.IMediaProjectionCallback;
@@ -68,6 +69,10 @@
private final Context mContext;
private final AppOpsManager mAppOps;
+ private final MediaRouter mMediaRouter;
+ private final MediaRouterCallback mMediaRouterCallback;
+ private MediaRouter.RouteInfo mMediaRouteInfo;
+
private IBinder mProjectionToken;
private MediaProjection mProjectionGrant;
@@ -77,6 +82,8 @@
mDeathEaters = new ArrayMap<IBinder, IBinder.DeathRecipient>();
mCallbackDelegate = new CallbackDelegate();
mAppOps = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
+ mMediaRouter = (MediaRouter) mContext.getSystemService(Context.MEDIA_ROUTER_SERVICE);
+ mMediaRouterCallback = new MediaRouterCallback();
Watchdog.getInstance().addMonitor(this);
}
@@ -84,6 +91,12 @@
public void onStart() {
publishBinderService(Context.MEDIA_PROJECTION_SERVICE, new BinderService(),
false /*allowIsolated*/);
+ mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY, mMediaRouterCallback);
+ }
+
+ @Override
+ public void onSwitchUser(int userId) {
+ mMediaRouter.rebindAsUser(userId);
}
@Override
@@ -95,6 +108,9 @@
if (mProjectionGrant != null) {
mProjectionGrant.stop();
}
+ if (mMediaRouteInfo != null) {
+ mMediaRouter.getDefaultRoute().select();
+ }
mProjectionToken = projection.asBinder();
mProjectionGrant = projection;
dispatchStart(projection);
@@ -448,6 +464,27 @@
}
}
+ private class MediaRouterCallback extends MediaRouter.SimpleCallback {
+ @Override
+ public void onRouteSelected(MediaRouter router, int type, MediaRouter.RouteInfo info) {
+ synchronized (mLock) {
+ if ((type & MediaRouter.ROUTE_TYPE_REMOTE_DISPLAY) != 0) {
+ mMediaRouteInfo = info;
+ if (mProjectionGrant != null) {
+ mProjectionGrant.stop();
+ }
+ }
+ }
+ }
+
+ @Override
+ public void onRouteUnselected(MediaRouter route, int type, MediaRouter.RouteInfo info) {
+ if (mMediaRouteInfo == info) {
+ mMediaRouteInfo = null;
+ }
+ }
+ }
+
private static class CallbackDelegate {
private Map<IBinder, IMediaProjectionCallback> mClientCallbacks;
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 479af89..5038d03 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -182,6 +182,12 @@
}
return shouldInterceptAudience(record);
}
+ if (isEvent(record)) {
+ if (!mConfig.allowEvents) {
+ ZenLog.traceIntercepted(record, "!allowEvents");
+ return true;
+ }
+ }
ZenLog.traceIntercepted(record, "!allowed");
return true;
}
@@ -328,17 +334,20 @@
}
}
- private boolean isSystem(NotificationRecord record) {
+ private static boolean isSystem(NotificationRecord record) {
return record.isCategory(Notification.CATEGORY_SYSTEM);
}
- private boolean isAlarm(NotificationRecord record) {
+ private static boolean isAlarm(NotificationRecord record) {
return record.isCategory(Notification.CATEGORY_ALARM)
- || record.isCategory(Notification.CATEGORY_EVENT)
|| record.isAudioStream(AudioManager.STREAM_ALARM)
|| record.isAudioAttributesUsage(AudioAttributes.USAGE_ALARM);
}
+ private static boolean isEvent(NotificationRecord record) {
+ return record.isCategory(Notification.CATEGORY_EVENT);
+ }
+
private boolean isCall(NotificationRecord record) {
return isDefaultPhoneApp(record.sbn.getPackageName())
|| record.isCategory(Notification.CATEGORY_CALL);
diff --git a/tools/aapt/AaptAssets.h b/tools/aapt/AaptAssets.h
index 3fc9f81..d809c5b 100644
--- a/tools/aapt/AaptAssets.h
+++ b/tools/aapt/AaptAssets.h
@@ -104,6 +104,9 @@
struct AaptGroupEntry
{
public:
+ AaptGroupEntry() {}
+ AaptGroupEntry(const ConfigDescription& config) : mParams(config) {}
+
bool initFromDirName(const char* dir, String8* resType);
inline const ConfigDescription& toParams() const { return mParams; }
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 137c85c..56d1650 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -1483,7 +1483,7 @@
return NO_ERROR;
}
-status_t postProcessImage(const sp<AaptAssets>& assets,
+status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
ResourceTable* table, const sp<AaptFile>& file)
{
String8 ext(file->getPath().getPathExtension());
@@ -1491,7 +1491,8 @@
// At this point, now that we have all the resource data, all we need to
// do is compile XML files.
if (strcmp(ext.string(), ".xml") == 0) {
- return compileXmlFile(assets, file, table);
+ String16 resourceName(parseResourceName(file->getPath().getPathLeaf()));
+ return compileXmlFile(bundle, assets, resourceName, file, table);
}
return NO_ERROR;
diff --git a/tools/aapt/Images.h b/tools/aapt/Images.h
index 91b6554..a0a94f8 100644
--- a/tools/aapt/Images.h
+++ b/tools/aapt/Images.h
@@ -20,7 +20,7 @@
status_t preProcessImageToCache(const Bundle* bundle, const String8& source, const String8& dest);
-status_t postProcessImage(const sp<AaptAssets>& assets,
+status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets,
ResourceTable* table, const sp<AaptFile>& file);
#endif
diff --git a/tools/aapt/Main.h b/tools/aapt/Main.h
index f24a023b..089dde5 100644
--- a/tools/aapt/Main.h
+++ b/tools/aapt/Main.h
@@ -62,4 +62,7 @@
status_t writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets,
FILE* fp, bool includeRaw);
+
+android::String8 parseResourceName(const String8& pathLeaf);
+
#endif // __MAIN_H
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index d605202..a4c9dab 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -50,7 +50,7 @@
// ==========================================================================
// ==========================================================================
-static String8 parseResourceName(const String8& leaf)
+String8 parseResourceName(const String8& leaf)
{
const char* firstDot = strchr(leaf.string(), '.');
const char* str = leaf.string();
@@ -1088,7 +1088,7 @@
manifest->addChild(app);
root->addChild(manifest);
- int err = compileXmlFile(assets, root, outFile, table);
+ int err = compileXmlFile(bundle, assets, String16(), root, outFile, table);
if (err < NO_ERROR) {
return err;
}
@@ -1336,7 +1336,8 @@
ResourceDirIterator it(layouts, String8("layout"));
while ((err=it.next()) == NO_ERROR) {
String8 src = it.getFile()->getPrintableSource();
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err == NO_ERROR) {
ResXMLTree block;
block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true);
@@ -1355,7 +1356,8 @@
if (anims != NULL) {
ResourceDirIterator it(anims, String8("anim"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1370,7 +1372,8 @@
if (animators != NULL) {
ResourceDirIterator it(animators, String8("animator"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1385,7 +1388,8 @@
if (interpolators != NULL) {
ResourceDirIterator it(interpolators, String8("interpolator"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1400,7 +1404,8 @@
if (transitions != NULL) {
ResourceDirIterator it(transitions, String8("transition"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1415,7 +1420,8 @@
if (xmls != NULL) {
ResourceDirIterator it(xmls, String8("xml"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1430,7 +1436,7 @@
if (drawables != NULL) {
ResourceDirIterator it(drawables, String8("drawable"));
while ((err=it.next()) == NO_ERROR) {
- err = postProcessImage(assets, &table, it.getFile());
+ err = postProcessImage(bundle, assets, &table, it.getFile());
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1445,7 +1451,8 @@
if (colors != NULL) {
ResourceDirIterator it(colors, String8("color"));
while ((err=it.next()) == NO_ERROR) {
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err != NO_ERROR) {
hasErrors = true;
}
@@ -1461,7 +1468,8 @@
ResourceDirIterator it(menus, String8("menu"));
while ((err=it.next()) == NO_ERROR) {
String8 src = it.getFile()->getPrintableSource();
- err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
+ err = compileXmlFile(bundle, assets, String16(it.getBaseName()),
+ it.getFile(), &table, xmlFlags);
if (err == NO_ERROR) {
ResXMLTree block;
block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true);
@@ -1477,6 +1485,22 @@
err = NO_ERROR;
}
+ // Now compile any generated resources.
+ std::queue<CompileResourceWorkItem>& workQueue = table.getWorkQueue();
+ while (!workQueue.empty()) {
+ CompileResourceWorkItem& workItem = workQueue.front();
+ err = compileXmlFile(bundle, assets, workItem.resourceName, workItem.file, &table, xmlFlags);
+ if (err == NO_ERROR) {
+ assets->addResource(workItem.resPath.getPathLeaf(),
+ workItem.resPath,
+ workItem.file,
+ workItem.file->getResourceType());
+ } else {
+ hasErrors = true;
+ }
+ workQueue.pop();
+ }
+
if (table.validateLocalizations()) {
hasErrors = true;
}
@@ -1509,7 +1533,7 @@
if (err < NO_ERROR) {
return err;
}
- err = compileXmlFile(assets, manifestTree, manifestFile, &table);
+ err = compileXmlFile(bundle, assets, String16(), manifestTree, manifestFile, &table);
if (err < NO_ERROR) {
return err;
}
@@ -1599,7 +1623,7 @@
sp<AaptFile> outManifestFile = new AaptFile(manifestFile->getSourceFile(),
manifestFile->getGroupEntry(),
manifestFile->getResourceType());
- err = compileXmlFile(assets, manifestFile,
+ err = compileXmlFile(bundle, assets, String16(), manifestFile,
outManifestFile, &table,
XML_COMPILE_ASSIGN_ATTRIBUTE_IDS
| XML_COMPILE_STRIP_WHITESPACE | XML_COMPILE_STRIP_RAW_VALUES);
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 8c9efc9..b8c34543 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -17,7 +17,9 @@
#define NOISY(x) //x
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<AaptFile>& target,
ResourceTable* table,
int options)
@@ -27,10 +29,12 @@
return UNKNOWN_ERROR;
}
- return compileXmlFile(assets, root, target, table, options);
+ return compileXmlFile(bundle, assets, resourceName, root, target, table, options);
}
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<AaptFile>& target,
const sp<AaptFile>& outTarget,
ResourceTable* table,
@@ -41,10 +45,12 @@
return UNKNOWN_ERROR;
}
- return compileXmlFile(assets, root, outTarget, table, options);
+ return compileXmlFile(bundle, assets, resourceName, root, outTarget, table, options);
}
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<XMLNode>& root,
const sp<AaptFile>& target,
ResourceTable* table,
@@ -77,6 +83,10 @@
if (hasErrors) {
return UNKNOWN_ERROR;
}
+
+ if (table->modifyForCompat(bundle, resourceName, target, root) != NO_ERROR) {
+ return UNKNOWN_ERROR;
+ }
NOISY(printf("Input XML Resource:\n"));
NOISY(root->print());
@@ -4028,6 +4038,39 @@
return t->getEntry(name, sourcePos, config, doSetIndex, overlay, mBundle->getAutoAddOverlay());
}
+sp<ResourceTable::ConfigList> ResourceTable::getConfigList(const String16& package,
+ const String16& type, const String16& name) const
+{
+ const size_t packageCount = mOrderedPackages.size();
+ for (size_t pi = 0; pi < packageCount; pi++) {
+ const sp<Package>& p = mOrderedPackages[pi];
+ if (p == NULL || p->getName() != package) {
+ continue;
+ }
+
+ const Vector<sp<Type> >& types = p->getOrderedTypes();
+ const size_t typeCount = types.size();
+ for (size_t ti = 0; ti < typeCount; ti++) {
+ const sp<Type>& t = types[ti];
+ if (t == NULL || t->getName() != type) {
+ continue;
+ }
+
+ const Vector<sp<ConfigList> >& configs = t->getOrderedConfigs();
+ const size_t configCount = configs.size();
+ for (size_t ci = 0; ci < configCount; ci++) {
+ const sp<ConfigList>& cl = configs[ci];
+ if (cl == NULL || cl->getName() != name) {
+ continue;
+ }
+
+ return cl;
+ }
+ }
+ }
+ return NULL;
+}
+
sp<const ResourceTable::Entry> ResourceTable::getEntry(uint32_t resID,
const ResTable_config* config) const
{
@@ -4157,6 +4200,22 @@
(attrId & 0x0000ffff) >= (baseAttrId & 0x0000ffff);
}
+static bool isMinSdkVersionLOrAbove(const Bundle* bundle) {
+ if (bundle->getMinSdkVersion() != NULL && strlen(bundle->getMinSdkVersion()) > 0) {
+ const char firstChar = bundle->getMinSdkVersion()[0];
+ if (firstChar >= 'L' && firstChar <= 'Z') {
+ // L is the code-name for the v21 release.
+ return true;
+ }
+
+ const int minSdk = atoi(bundle->getMinSdkVersion());
+ if (minSdk >= SDK_L) {
+ return true;
+ }
+ }
+ return false;
+}
+
/**
* Modifies the entries in the resource table to account for compatibility
* issues with older versions of Android.
@@ -4200,19 +4259,10 @@
* attribute will be respected.
*/
status_t ResourceTable::modifyForCompat(const Bundle* bundle) {
- if (bundle->getMinSdkVersion() != NULL) {
+ if (isMinSdkVersionLOrAbove(bundle)) {
// If this app will only ever run on L+ devices,
// we don't need to do any compatibility work.
-
- if (String8("L") == bundle->getMinSdkVersion()) {
- // Code-name for the v21 release.
- return NO_ERROR;
- }
-
- const int minSdk = atoi(bundle->getMinSdkVersion());
- if (minSdk >= SDK_L) {
- return NO_ERROR;
- }
+ return NO_ERROR;
}
const String16 attr16("attr");
@@ -4309,3 +4359,104 @@
}
return NO_ERROR;
}
+
+status_t ResourceTable::modifyForCompat(const Bundle* bundle,
+ const String16& resourceName,
+ const sp<AaptFile>& target,
+ const sp<XMLNode>& root) {
+ if (isMinSdkVersionLOrAbove(bundle)) {
+ return NO_ERROR;
+ }
+
+ if (target->getResourceType() == "" || target->getGroupEntry().toParams().sdkVersion >= SDK_L) {
+ // Skip resources that have no type (AndroidManifest.xml) or are already version qualified with v21
+ // or higher.
+ return NO_ERROR;
+ }
+
+ Vector<key_value_pair_t<sp<XMLNode>, size_t> > attrsToRemove;
+
+ Vector<sp<XMLNode> > nodesToVisit;
+ nodesToVisit.push(root);
+ while (!nodesToVisit.isEmpty()) {
+ sp<XMLNode> node = nodesToVisit.top();
+ nodesToVisit.pop();
+
+ const Vector<XMLNode::attribute_entry>& attrs = node->getAttributes();
+ const size_t attrCount = attrs.size();
+ for (size_t i = 0; i < attrCount; i++) {
+ const XMLNode::attribute_entry& attr = attrs[i];
+ if (isAttributeFromL(attr.nameResId)) {
+ attrsToRemove.add(key_value_pair_t<sp<XMLNode>, size_t>(node, i));
+ }
+ }
+
+ // Schedule a visit to the children.
+ const Vector<sp<XMLNode> >& children = node->getChildren();
+ const size_t childCount = children.size();
+ for (size_t i = 0; i < childCount; i++) {
+ nodesToVisit.push(children[i]);
+ }
+ }
+
+ if (attrsToRemove.isEmpty()) {
+ return NO_ERROR;
+ }
+
+ ConfigDescription newConfig(target->getGroupEntry().toParams());
+ newConfig.sdkVersion = SDK_L;
+
+ // Look to see if we already have an overriding v21 configuration.
+ sp<ConfigList> cl = getConfigList(String16(mAssets->getPackage()),
+ String16(target->getResourceType()), resourceName);
+ if (cl->getEntries().indexOfKey(newConfig) < 0) {
+ // We don't have an overriding entry for v21, so we must duplicate this one.
+ sp<XMLNode> newRoot = root->clone();
+ sp<AaptFile> newFile = new AaptFile(target->getSourceFile(),
+ AaptGroupEntry(newConfig), target->getResourceType());
+ String8 resPath = String8::format("res/%s/%s",
+ newFile->getGroupEntry().toDirName(target->getResourceType()).string(),
+ target->getPath().getPathLeaf().string());
+ resPath.convertToResPath();
+
+ // Add a resource table entry.
+ SourcePos(target->getSourceFile(), -1).printf(
+ "using v%d attributes; synthesizing resource %s:%s/%s for configuration %s.",
+ SDK_L,
+ mAssets->getPackage().string(),
+ newFile->getResourceType().string(),
+ String8(resourceName).string(),
+ newConfig.toString().string());
+
+ addEntry(SourcePos(),
+ String16(mAssets->getPackage()),
+ String16(target->getResourceType()),
+ resourceName,
+ String16(resPath),
+ NULL,
+ &newConfig);
+
+ // Schedule this to be compiled.
+ CompileResourceWorkItem item;
+ item.resourceName = resourceName;
+ item.resPath = resPath;
+ item.file = newFile;
+ mWorkQueue.push(item);
+ }
+
+ const size_t removeCount = attrsToRemove.size();
+ for (size_t i = 0; i < removeCount; i++) {
+ sp<XMLNode> node = attrsToRemove[i].key;
+ size_t attrIndex = attrsToRemove[i].value;
+ const XMLNode::attribute_entry& ae = node->getAttributes()[attrIndex];
+ SourcePos(node->getFilename(), node->getStartLineNumber()).printf(
+ "removing attribute %s%s%s from <%s>",
+ String8(ae.ns).string(),
+ (ae.ns.size() == 0 ? "" : ":"),
+ String8(ae.name).string(),
+ String8(node->getElementName()).string());
+ node->removeAttribute(attrIndex);
+ }
+
+ return NO_ERROR;
+}
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index 025a868..c548a85 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -12,8 +12,9 @@
#include "SourcePos.h"
#include "ResourceFilter.h"
-#include <set>
#include <map>
+#include <queue>
+#include <set>
using namespace std;
@@ -33,18 +34,24 @@
| XML_COMPILE_STRIP_WHITESPACE | XML_COMPILE_STRIP_RAW_VALUES
};
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<AaptFile>& target,
ResourceTable* table,
int options = XML_COMPILE_STANDARD_RESOURCE);
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<AaptFile>& target,
const sp<AaptFile>& outTarget,
ResourceTable* table,
int options = XML_COMPILE_STANDARD_RESOURCE);
-status_t compileXmlFile(const sp<AaptAssets>& assets,
+status_t compileXmlFile(const Bundle* bundle,
+ const sp<AaptAssets>& assets,
+ const String16& resourceName,
const sp<XMLNode>& xmlTree,
const sp<AaptFile>& target,
ResourceTable* table,
@@ -71,6 +78,14 @@
}
};
+// Holds the necessary information to compile the
+// resource.
+struct CompileResourceWorkItem {
+ String16 resourceName;
+ String8 resPath;
+ sp<AaptFile> file;
+};
+
class ResourceTable : public ResTable::Accessor
{
public:
@@ -92,6 +107,18 @@
return mAssetsPackage;
}
+ /**
+ * Returns the queue of resources that need to be compiled.
+ * This is only used for resources that have been generated
+ * during the compilation phase. If they were just added
+ * to the AaptAssets, then they may be skipped over
+ * and would mess up iteration order for the existing
+ * resources.
+ */
+ queue<CompileResourceWorkItem>& getWorkQueue() {
+ return mWorkQueue;
+ }
+
status_t addIncludedResources(Bundle* bundle, const sp<AaptAssets>& assets);
status_t addPublic(const SourcePos& pos,
@@ -166,6 +193,10 @@
bool hasResources() const;
status_t modifyForCompat(const Bundle* bundle);
+ status_t modifyForCompat(const Bundle* bundle,
+ const String16& resourceName,
+ const sp<AaptFile>& file,
+ const sp<XMLNode>& root);
sp<AaptFile> flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
const bool isBase);
@@ -527,6 +558,9 @@
bool doSetIndex = false);
sp<const Entry> getEntry(uint32_t resID,
const ResTable_config* config = NULL) const;
+ sp<ConfigList> getConfigList(const String16& package,
+ const String16& type,
+ const String16& name) const;
const Item* getItem(uint32_t resID, uint32_t attrID) const;
bool getItemValue(uint32_t resID, uint32_t attrID,
Res_value* outValue);
@@ -545,6 +579,7 @@
// key = string resource name, value = set of locales in which that name is defined
map<String16, map<String8, SourcePos> > mLocalizations;
+ queue<CompileResourceWorkItem> mWorkQueue;
};
#endif
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 607d419..51a4154 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -621,6 +621,12 @@
return state.root;
}
+XMLNode::XMLNode()
+ : mNextAttributeIndex(0x80000000)
+ , mStartLineNumber(0)
+ , mEndLineNumber(0)
+ , mUTF8(false) {}
+
XMLNode::XMLNode(const String8& filename, const String16& s1, const String16& s2, bool isNamespace)
: mNextAttributeIndex(0x80000000)
, mFilename(filename)
@@ -810,6 +816,32 @@
return NO_ERROR;
}
+status_t XMLNode::removeAttribute(size_t index)
+{
+ if (getType() == TYPE_CDATA) {
+ return UNKNOWN_ERROR;
+ }
+
+ if (index >= mAttributes.size()) {
+ return UNKNOWN_ERROR;
+ }
+
+ const attribute_entry& e = mAttributes[index];
+ const uint32_t key = e.nameResId ? e.nameResId : e.index;
+ mAttributeOrder.removeItem(key);
+ mAttributes.removeAt(index);
+
+ // Shift all the indices.
+ const size_t attrCount = mAttributeOrder.size();
+ for (size_t i = 0; i < attrCount; i++) {
+ size_t attrIdx = mAttributeOrder[i];
+ if (attrIdx > index) {
+ mAttributeOrder.replaceValueAt(i, attrIdx - 1);
+ }
+ }
+ return NO_ERROR;
+}
+
void XMLNode::setAttributeResID(size_t attrIdx, uint32_t resId)
{
attribute_entry& e = mAttributes.editItemAt(attrIdx);
@@ -999,6 +1031,30 @@
return hasErrors ? UNKNOWN_ERROR : NO_ERROR;
}
+sp<XMLNode> XMLNode::clone() const {
+ sp<XMLNode> copy = new XMLNode();
+ copy->mNamespacePrefix = mNamespacePrefix;
+ copy->mNamespaceUri = mNamespaceUri;
+ copy->mElementName = mElementName;
+
+ const size_t childCount = mChildren.size();
+ for (size_t i = 0; i < childCount; i++) {
+ copy->mChildren.add(mChildren[i]->clone());
+ }
+
+ copy->mAttributes = mAttributes;
+ copy->mAttributeOrder = mAttributeOrder;
+ copy->mNextAttributeIndex = mNextAttributeIndex;
+ copy->mChars = mChars;
+ memcpy(©->mCharsValue, &mCharsValue, sizeof(mCharsValue));
+ copy->mComment = mComment;
+ copy->mFilename = mFilename;
+ copy->mStartLineNumber = mStartLineNumber;
+ copy->mEndLineNumber = mEndLineNumber;
+ copy->mUTF8 = mUTF8;
+ return copy;
+}
+
status_t XMLNode::flatten(const sp<AaptFile>& dest,
bool stripComments, bool stripRawValues) const
{
diff --git a/tools/aapt/XMLNode.h b/tools/aapt/XMLNode.h
index ccbf9f4..3161f65 100644
--- a/tools/aapt/XMLNode.h
+++ b/tools/aapt/XMLNode.h
@@ -116,6 +116,8 @@
status_t addAttribute(const String16& ns, const String16& name,
const String16& value);
+ status_t removeAttribute(size_t index);
+
void setAttributeResID(size_t attrIdx, uint32_t resId);
status_t appendChars(const String16& chars);
@@ -137,6 +139,8 @@
status_t flatten(const sp<AaptFile>& dest, bool stripComments,
bool stripRawValues) const;
+ sp<XMLNode> clone() const;
+
void print(int indent=0);
private:
@@ -163,6 +167,9 @@
static void XMLCALL
commentData(void *userData, const char *comment);
+ // For cloning
+ XMLNode();
+
// Creating an element node.
XMLNode(const String8& filename, const String16& s1, const String16& s2, bool isNamespace);