Merge "Clear calling identity" into nyc-mr1-dev
diff --git a/core/java/android/os/FileObserver.java b/core/java/android/os/FileObserver.java
index 4e705e0..dd85e15 100644
--- a/core/java/android/os/FileObserver.java
+++ b/core/java/android/os/FileObserver.java
@@ -16,6 +16,7 @@
package android.os;
+import android.annotation.Nullable;
import android.util.Log;
import java.lang.ref.WeakReference;
@@ -204,7 +205,8 @@
*
* @param event The type of event which happened
* @param path The path, relative to the main monitored file or directory,
- * of the file or directory which triggered the event
+ * of the file or directory which triggered the event. This value can
+ * be {@code null} for certain events, such as {@link #MOVE_SELF}.
*/
- public abstract void onEvent(int event, String path);
+ public abstract void onEvent(int event, @Nullable String path);
}
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 5935c78..b12c03c 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -193,6 +193,8 @@
private int mAnimationStyle = ANIMATION_STYLE_DEFAULT;
+ private int mGravity = Gravity.NO_GRAVITY;
+
private static final int[] ABOVE_ANCHOR_STATE_SET = new int[] {
com.android.internal.R.attr.state_above_anchor
};
@@ -1141,15 +1143,11 @@
mIsShowing = true;
mIsDropdown = false;
+ mGravity = gravity;
final WindowManager.LayoutParams p = createPopupLayoutParams(token);
preparePopup(p);
- // Only override the default if some gravity was specified.
- if (gravity != Gravity.NO_GRAVITY) {
- p.gravity = gravity;
- }
-
p.x = x;
p.y = y;
@@ -1394,8 +1392,8 @@
}
private int computeGravity() {
- int gravity = Gravity.START | Gravity.TOP;
- if (mClipToScreen || mClippingEnabled) {
+ int gravity = mGravity == Gravity.NO_GRAVITY ? Gravity.START | Gravity.TOP : mGravity;
+ if (mIsDropdown && (mClipToScreen || mClippingEnabled)) {
gravity |= Gravity.DISPLAY_CLIP_VERTICAL;
}
return gravity;
diff --git a/core/res/res/values-mcc302-mnc220/config.xml b/core/res/res/values-mcc302-mnc220/config.xml
index 454e4b6..f2933b7 100644
--- a/core/res/res/values-mcc302-mnc220/config.xml
+++ b/core/res/res/values-mcc302-mnc220/config.xml
@@ -42,4 +42,23 @@
<item>[ApnSettingV3]Tethered Public Mobile,isp.mb.com,,,,,,,,,302,220,,DUN,,,true,0,,,,,,,gid,4D4F</item>
</string-array>
+ <!-- Values for GPS configuration (Telus) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
+
</resources>
diff --git a/core/res/res/values-mcc302-mnc221/config.xml b/core/res/res/values-mcc302-mnc221/config.xml
index ffc9d6c..28b5545 100644
--- a/core/res/res/values-mcc302-mnc221/config.xml
+++ b/core/res/res/values-mcc302-mnc221/config.xml
@@ -32,4 +32,23 @@
<item>[ApnSettingV3]Koodo,sp.koodo.com,,,,,,,,,302,221,,DUN,,,true,0,,,,,,,gid,4B</item>
</string-array>
+ <!-- Values for GPS configuration (Telus) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
+
</resources>
diff --git a/core/res/res/values-mcc302-mnc370/config.xml b/core/res/res/values-mcc302-mnc370/config.xml
index 5e7e8bc..ec402fb 100644
--- a/core/res/res/values-mcc302-mnc370/config.xml
+++ b/core/res/res/values-mcc302-mnc370/config.xml
@@ -43,4 +43,23 @@
<item>302780</item>
</string-array>
+ <!-- Values for GPS configuration (Rogers) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
+
</resources>
diff --git a/core/res/res/values-mcc302-mnc610/config.xml b/core/res/res/values-mcc302-mnc610/config.xml
index 81cec96..73604a3 100644
--- a/core/res/res/values-mcc302-mnc610/config.xml
+++ b/core/res/res/values-mcc302-mnc610/config.xml
@@ -27,4 +27,22 @@
-->
<integer name="config_mobile_mtu">1428</integer>
+ <!-- Values for GPS configuration (Bell) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values-mcc302-mnc640/config.xml b/core/res/res/values-mcc302-mnc640/config.xml
index 706570c..8597c65 100644
--- a/core/res/res/values-mcc302-mnc640/config.xml
+++ b/core/res/res/values-mcc302-mnc640/config.xml
@@ -22,4 +22,23 @@
<string-array translatable="false" name="config_operatorConsideredNonRoaming">
<item>302</item>
</string-array>
+
+ <!-- Values for GPS configuration (Bell) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
</resources>
diff --git a/core/res/res/values-mcc302-mnc720/config.xml b/core/res/res/values-mcc302-mnc720/config.xml
index dcfa5c5..8b4ed30 100644
--- a/core/res/res/values-mcc302-mnc720/config.xml
+++ b/core/res/res/values-mcc302-mnc720/config.xml
@@ -45,4 +45,23 @@
<item>302780</item>
</string-array>
+ <!-- Values for GPS configuration (Rogers) -->
+ <string-array translatable="false" name="config_gpsParameters">
+ <item>SUPL_HOST=supl.google.com</item>
+ <item>SUPL_PORT=7275</item>
+ <item>XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin</item>
+ <item>XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin</item>
+ <item>NTP_SERVER=north-america.pool.ntp.org</item>
+ <item>SUPL_MODE=1</item>
+ <item>SUPL_VER=0x20000</item>
+ <item>LPP_PROFILE=2</item>
+ <item>NMEA_PROVIDER=0</item>
+ <item>A_GLONASS_POS_PROTOCOL_SELECT=0</item>
+ <item>ERR_ESTIMATE=0</item>
+ <item>INTERMEDIATE_POS=0</item>
+ <item>GPS_LOCK=3</item>
+ <item>SUPL_ES=1</item>
+ </string-array>
+
</resources>
diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml
index c689378..4fed558 100644
--- a/docs/html/_redirects.yaml
+++ b/docs/html/_redirects.yaml
@@ -1214,13 +1214,31 @@
- from: /r/studio-ui/sdk-manager.html
to: /studio/intro/update.html?utm_medium=android-studio#sdk-manager
- from: /r/studio-ui/newjclass.html
- to: /studio/write/index.html?utm_medium=android-studio
+ to: /studio/write/create-java-class.html?utm_medium=android-studio
- from: /r/studio-ui/menu-help.html
to: /studio/intro/index.html?utm_medium=android-studio
- from: /r/studio-ui/menu-start.html
to: /training/index.html?utm_medium=android-studio
- from: /r/studio-ui/run-with-work-profile.html
to: /studio/run/index.html#ir-work-profile?utm_medium=android-studio
+- from: /r/studio-ui/gpu-debugger.html
+ to: /studio/profile/am-gpu.html?utm_medium=android-studio
+- from: /r/studio-ui/theme-editor.html
+ to: /studio/write/theme-editor.html?utm_medium=android-studio
+- from: /r/studio-ui/translations-editor.html
+ to: /studio/write/translations-editor.html?utm_medium=android-studio
+- from: /r/studio-ui/debug.html
+ to: /studio/debug/index.html?utm_medium=android-studio
+- from: /r/studio-ui/run.html
+ to: /studio/run/index.html?utm_medium=android-studio
+- from: /r/studio-ui/layout-editor.html
+ to: /studio/write/layout-editor.html?utm_medium=android-studio
+- from: /r/studio-ui/project-window.html
+ to: /studio/projects/index.html?utm_medium=android-studio
+- from: /r/studio-ui/lint-inspection-results.html
+ to: /studio/write/lint.html?utm_medium=android-studio
+- from: /r/studio-ui/gradle-console.html
+ to: /studio/run/index.html#gradle-console?utm_medium=android-studio
# Redirects from (removed) N Preview documentation
- from: /preview/features/afw.html
diff --git a/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java
index c0646ce..0e3e0d5 100644
--- a/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java
+++ b/packages/SettingsLib/src/com/android/settingslib/deviceinfo/StorageMeasurement.java
@@ -79,7 +79,6 @@
public static class MeasurementDetails {
public long totalSize;
public long availSize;
- private long accountedSize;
/**
* Total apps disk usage per profiles of the current user.
@@ -127,17 +126,6 @@
* internal storage. Key is {@link UserHandle}.
*/
public SparseLongArray usersSize = new SparseLongArray();
-
- /**
- * Gets the total disk usage that is not accounted for.
- *
- * <p>
- * Typically used by device-specific processes that the Framework has no control over.
- */
- public long getUnaccountedSize() {
- final long usedSize = totalSize - availSize;
- return usedSize - accountedSize;
- }
}
public interface MeasurementReceiver {
@@ -231,43 +219,34 @@
}
private void addStatsLocked(PackageStats stats) {
- synchronized (mDetails) {
- long accountedAppSize = 0;
- long accountedCacheSize = 0;
- if (mIsPrivate) {
- long codeSize = stats.codeSize;
- long dataSize = stats.dataSize;
- long cacheSize = stats.cacheSize;
- if (Environment.isExternalStorageEmulated()) {
- // Include emulated storage when measuring internal. OBB is
- // shared on emulated storage, so treat as code.
- codeSize += stats.externalCodeSize + stats.externalObbSize;
- dataSize += stats.externalDataSize + stats.externalMediaSize;
- cacheSize += stats.externalCacheSize;
- }
- accountedAppSize += dataSize;
- // Count code and data for current user's profiles (keys prepared in constructor)
- if (addValueIfKeyExists(mDetails.appsSize, stats.userHandle,
- codeSize + dataSize)) {
- // Code is only counted once for the current user
- accountedAppSize += codeSize;
- }
- // User summary only includes data (code is only counted once
- // for the current user)
- addValue(mDetails.usersSize, stats.userHandle, dataSize);
-
- // Include cache for all users
- accountedCacheSize = cacheSize;
-
- } else {
- // Physical storage; only count external sizes
- addValue(mDetails.appsSize, mCurrentUser,
- stats.externalCodeSize + stats.externalDataSize
- + stats.externalMediaSize + stats.externalObbSize);
- accountedCacheSize = stats.externalCacheSize;
+ if (mIsPrivate) {
+ long codeSize = stats.codeSize;
+ long dataSize = stats.dataSize;
+ long cacheSize = stats.cacheSize;
+ if (Environment.isExternalStorageEmulated()) {
+ // Include emulated storage when measuring internal. OBB is
+ // shared on emulated storage, so treat as code.
+ codeSize += stats.externalCodeSize + stats.externalObbSize;
+ dataSize += stats.externalDataSize + stats.externalMediaSize;
+ cacheSize += stats.externalCacheSize;
}
- mDetails.cacheSize += accountedCacheSize;
- mDetails.accountedSize += accountedAppSize + accountedCacheSize;
+
+ // Count code and data for current user's profiles (keys prepared in constructor)
+ addValueIfKeyExists(mDetails.appsSize, stats.userHandle, codeSize + dataSize);
+
+ // User summary only includes data (code is only counted once
+ // for the current user)
+ addValue(mDetails.usersSize, stats.userHandle, dataSize);
+
+ // Include cache for all users
+ mDetails.cacheSize += cacheSize;
+
+ } else {
+ // Physical storage; only count external sizes
+ addValue(mDetails.appsSize, mCurrentUser,
+ stats.externalCodeSize + stats.externalDataSize
+ + stats.externalMediaSize + stats.externalObbSize);
+ mDetails.cacheSize += stats.externalCacheSize;
}
}
}
@@ -396,14 +375,11 @@
for (String type : sMeasureMediaTypes) {
final File path = new File(basePath, type);
final long size = getDirectorySize(imcs, path);
- details.accountedSize += size;
mediaMap.put(type, size);
}
// Measure misc files not counted under media
- final long miscSize = measureMisc(imcs, basePath);
- details.accountedSize += miscSize;
- addValue(details.miscSize, userId, miscSize);
+ addValue(details.miscSize, userId, measureMisc(imcs, basePath));
}
if (mSharedVolume.getType() == VolumeInfo.TYPE_EMULATED) {
@@ -412,9 +388,6 @@
for (UserInfo user : users) {
final File userPath = mSharedVolume.getPathForUser(user.id);
final long size = getDirectorySize(imcs, userPath);
- if (user.id != UserHandle.USER_SYSTEM) {
- details.accountedSize += size;
- }
addValue(details.usersSize, user.id, size);
}
}
@@ -495,12 +468,10 @@
array.put(key, array.get(key) + value);
}
- private static boolean addValueIfKeyExists(SparseLongArray array, int key, long value) {
+ private static void addValueIfKeyExists(SparseLongArray array, int key, long value) {
final int index = array.indexOfKey(key);
if (index >= 0) {
array.put(key, array.valueAt(index) + value);
- return true;
}
- return false;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 6d73ccb..cf962df 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -93,8 +93,10 @@
ServiceManager.getService(BatteryStats.SERVICE_NAME));
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitor);
- context.registerReceiverAsUser(mReceiver, UserHandle.SYSTEM,
+ context.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM,
new IntentFilter(Intent.ACTION_TIME_TICK), null, null);
+ context.registerReceiverAsUser(mUnlockReceiver, UserHandle.ALL,
+ new IntentFilter(Intent.ACTION_USER_UNLOCKED), null, null);
}
public void setVisible(boolean visible) {
@@ -322,7 +324,16 @@
}
};
- BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ BroadcastReceiver mTickReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (mVisible) {
+ updateIndication();
+ }
+ }
+ };
+
+ BroadcastReceiver mUnlockReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (mVisible) {
diff --git a/packages/SystemUI/tests/Android.mk b/packages/SystemUI/tests/Android.mk
index 188f8bf..d122ccc 100644
--- a/packages/SystemUI/tests/Android.mk
+++ b/packages/SystemUI/tests/Android.mk
@@ -58,9 +58,42 @@
# UI it doesn't own. This is necessary to allow screenshots to be taken
LOCAL_CERTIFICATE := platform
+# Provide jack a list of classes to exclude from code coverage.
+# This is needed because the SystemUITests compile SystemUI source directly, rather than using
+# LOCAL_INSTRUMENTATION_FOR := SystemUI.
+#
+# We want to exclude the test classes from code coverage measurements, but they share the same
+# package as the rest of SystemUI so they can't be easily filtered by package name.
+#
+# Generate a comma separated list of patterns based on the test source files under src/
+# SystemUI classes are in ../src/ so they won't be excluded.
+# Example:
+# Input files: src/com/android/systemui/Test.java src/com/android/systemui/AnotherTest.java
+# Generated exclude list: com.android.systemui.Test*,com.android.systemui.AnotherTest*
+
+# Filter all src files under src/ to just java files
+local_java_files := $(filter %.java,$(call all-java-files-under, src))
+# Transform java file names into full class names.
+# This only works if the class name matches the file name and the directory structure
+# matches the package.
+local_classes := $(subst /,.,$(patsubst src/%.java,%,$(local_java_files)))
+local_comma := ,
+local_empty :=
+local_space := $(local_empty) $(local_empty)
+# Convert class name list to jacoco exclude list
+# This appends a * to all classes and replace the space separators with commas.
+jacoco_exclude := $(subst $(space),$(comma),$(patsubst %,%*,$(local_classes)))
+
LOCAL_JACK_COVERAGE_INCLUDE_FILTER := com.android.systemui.*
-LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := com.android.systemui.tests.*
+LOCAL_JACK_COVERAGE_EXCLUDE_FILTER := com.android.systemui.tests.*,$(jacoco_exclude)
include frameworks/base/packages/SettingsLib/common.mk
include $(BUILD_PACKAGE)
+
+# Reset variables
+local_java_files :=
+local_classes :=
+local_comma :=
+local_space :=
+jacoco_exclude :=
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index cdd977b..0023e4b 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -1056,6 +1056,10 @@
|| mForceAdoptable) {
flags |= DiskInfo.FLAG_ADOPTABLE;
}
+ // Adoptable storage isn't currently supported on FBE devices
+ if (StorageManager.isFileEncryptedNativeOnly()) {
+ flags &= ~DiskInfo.FLAG_ADOPTABLE;
+ }
mDisks.put(id, new DiskInfo(id, flags));
break;
}
@@ -1985,6 +1989,11 @@
}
if ((mask & StorageManager.DEBUG_FORCE_ADOPTABLE) != 0) {
+ if (StorageManager.isFileEncryptedNativeOnly()) {
+ throw new IllegalStateException(
+ "Adoptable storage not available on device with native FBE");
+ }
+
synchronized (mLock) {
mForceAdoptable = (flags & StorageManager.DEBUG_FORCE_ADOPTABLE) != 0;
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java
index 45a9644..971989b 100644
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -1402,7 +1402,7 @@
throw new IllegalArgumentException("width, height, and densityDpi must be "
+ "greater than 0");
}
- if (surface.isSingleBuffered()) {
+ if (surface != null && surface.isSingleBuffered()) {
throw new IllegalArgumentException("Surface can't be single-buffered");
}
@@ -1463,6 +1463,9 @@
@Override // Binder call
public void setVirtualDisplaySurface(IVirtualDisplayCallback callback, Surface surface) {
+ if (surface != null && surface.isSingleBuffered()) {
+ throw new IllegalArgumentException("Surface can't be single-buffered");
+ }
final long token = Binder.clearCallingIdentity();
try {
setVirtualDisplaySurfaceInternal(callback.asBinder(), surface);
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index f3fc676..d5da66b 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -513,12 +513,13 @@
try {
app = pm.getApplicationInfoAsUser(pkg, PackageManager.MATCH_SYSTEM_ONLY, userId);
} catch (PackageManager.NameNotFoundException e) {
- // Should not happen
- Slog.wtf(TAG, "No ApplicationInfo for package " + pkg);
+ if (LOGD) Slog.d(TAG, "No ApplicationInfo for package " + pkg);
+ // Ignore it - some apps on allow-in-data-usage-save are optional.
continue;
}
if (!app.isPrivilegedApp()) {
- Slog.wtf(TAG, "pm.getApplicationInfoAsUser() returned non-privileged app: " + pkg);
+ Slog.e(TAG, "addDefaultRestrictBackgroundWhitelistUidsUL(): "
+ + "skipping non-privileged app " + pkg);
continue;
}
final int uid = UserHandle.getUid(userId, app.uid);
@@ -528,8 +529,9 @@
+ "background whitelist. Revoked status: "
+ mRestrictBackgroundWhitelistRevokedUids.get(uid));
if (!mRestrictBackgroundWhitelistRevokedUids.get(uid)) {
- Slog.i(TAG, "adding default package " + pkg + " (uid " + uid + " for user "
- + userId + ") to restrict background whitelist");
+ if (LOGD)
+ Slog.d(TAG, "adding default package " + pkg + " (uid " + uid + " for user "
+ + userId + ") to restrict background whitelist");
mRestrictBackgroundWhitelistUids.append(uid, true);
changed = true;
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index f84356b..baed609 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -458,6 +458,8 @@
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
+ private static final String PACKAGE_SCHEME = "package";
+
private static final String VENDOR_OVERLAY_DIR = "/vendor/overlay";
private static int DEFAULT_EPHEMERAL_HASH_PREFIX_MASK = 0xFFFFF000;
@@ -1121,6 +1123,7 @@
final @Nullable String mRequiredVerifierPackage;
final @NonNull String mRequiredInstallerPackage;
+ final @NonNull String mRequiredUninstallerPackage;
final @Nullable String mSetupWizardPackage;
final @NonNull String mServicesSystemSharedLibraryPackageName;
final @NonNull String mSharedSystemSharedLibraryPackageName;
@@ -2626,6 +2629,7 @@
if (!mOnlyCore) {
mRequiredVerifierPackage = getRequiredButNotReallyRequiredVerifierLPr();
mRequiredInstallerPackage = getRequiredInstallerLPr();
+ mRequiredUninstallerPackage = getRequiredUninstallerLPr();
mIntentFilterVerifierComponent = getIntentFilterVerifierComponentNameLPr();
mIntentFilterVerifier = new IntentVerifierProxy(mContext,
mIntentFilterVerifierComponent);
@@ -2636,6 +2640,7 @@
} else {
mRequiredVerifierPackage = null;
mRequiredInstallerPackage = null;
+ mRequiredUninstallerPackage = null;
mIntentFilterVerifierComponent = null;
mIntentFilterVerifier = null;
mServicesSystemSharedLibraryPackageName = null;
@@ -2713,10 +2718,11 @@
UserHandle.USER_SYSTEM);
if (matches.size() == 1) {
return matches.get(0).getComponentInfo().packageName;
- } else {
- Log.e(TAG, "There should probably be exactly one verifier; found " + matches);
+ } else if (matches.size() == 0) {
+ Log.e(TAG, "There should probably be a verifier, but, none were found");
return null;
}
+ throw new RuntimeException("There must be exactly one verifier; found " + matches);
}
private @NonNull String getRequiredSharedLibraryLPr(String libraryName) {
@@ -2748,6 +2754,22 @@
}
}
+ private @NonNull String getRequiredUninstallerLPr() {
+ final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+ intent.setData(Uri.fromParts(PACKAGE_SCHEME, "foo.bar", null));
+
+ final ResolveInfo resolveInfo = resolveIntent(intent, null,
+ MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE,
+ UserHandle.USER_SYSTEM);
+ if (resolveInfo == null ||
+ mResolveActivity.name.equals(resolveInfo.getComponentInfo().name)) {
+ throw new RuntimeException("There must be exactly one uninstaller; found "
+ + resolveInfo);
+ }
+ return resolveInfo.getComponentInfo().packageName;
+ }
+
private @NonNull ComponentName getIntentFilterVerifierComponentNameLPr() {
final Intent intent = new Intent(Intent.ACTION_INTENT_FILTER_NEEDS_VERIFICATION);
@@ -11314,7 +11336,7 @@
}
for (int id : resolvedUserIds) {
final Intent intent = new Intent(action,
- pkg != null ? Uri.fromParts("package", pkg, null) : null);
+ pkg != null ? Uri.fromParts(PACKAGE_SCHEME, pkg, null) : null);
if (extras != null) {
intent.putExtras(extras);
}
@@ -11810,6 +11832,12 @@
return false;
}
+ if (packageName.equals(mRequiredUninstallerPackage)) {
+ Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName
+ + "\": required for package uninstallation");
+ return false;
+ }
+
if (packageName.equals(mRequiredVerifierPackage)) {
Slog.w(TAG, "Cannot suspend/un-suspend package \"" + packageName
+ "\": required for package verification");
@@ -15374,13 +15402,11 @@
Preconditions.checkNotNull(packageName);
Preconditions.checkNotNull(observer);
final int uid = Binder.getCallingUid();
- if (uid != Process.SHELL_UID && uid != Process.ROOT_UID && uid != Process.SYSTEM_UID
- && uid != getPackageUid(mRequiredInstallerPackage, 0, UserHandle.getUserId(uid))
- && !isOrphaned(packageName)
- && !isCallerSameAsInstaller(uid, packageName)) {
+ if (!isOrphaned(packageName)
+ && !isCallerAllowedToSilentlyUninstall(uid, packageName)) {
try {
final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
- intent.setData(Uri.fromParts("package", packageName, null));
+ intent.setData(Uri.fromParts(PACKAGE_SCHEME, packageName, null));
intent.putExtra(PackageInstaller.EXTRA_CALLBACK, observer.asBinder());
observer.onUserActionRequired(intent);
} catch (RemoteException re) {
@@ -15455,10 +15481,29 @@
});
}
- private boolean isCallerSameAsInstaller(int callingUid, String pkgName) {
- final int installerPkgUid = getPackageUid(getInstallerPackageName(pkgName),
- 0 /* flags */, UserHandle.getUserId(callingUid));
- return installerPkgUid == callingUid;
+ private boolean isCallerAllowedToSilentlyUninstall(int callingUid, String pkgName) {
+ if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID
+ || callingUid == Process.SYSTEM_UID) {
+ return true;
+ }
+ final int callingUserId = UserHandle.getUserId(callingUid);
+ // If the caller installed the pkgName, then allow it to silently uninstall.
+ if (callingUid == getPackageUid(getInstallerPackageName(pkgName), 0, callingUserId)) {
+ return true;
+ }
+
+ // Allow package verifier to silently uninstall.
+ if (mRequiredVerifierPackage != null &&
+ callingUid == getPackageUid(mRequiredVerifierPackage, 0, callingUserId)) {
+ return true;
+ }
+
+ // Allow package uninstaller to silently uninstall.
+ if (mRequiredUninstallerPackage != null &&
+ callingUid == getPackageUid(mRequiredUninstallerPackage, 0, callingUserId)) {
+ return true;
+ }
+ return false;
}
private int[] getBlockUninstallForUsers(String packageName, int[] userIds) {
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 3fd4b37..536e646 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -352,9 +352,17 @@
(cropHint.right > options.outWidth ? options.outWidth - cropHint.right : 0),
(cropHint.bottom > options.outHeight ? options.outHeight - cropHint.bottom : 0));
+ // If the crop hint was larger than the image we just overshot. Patch things up.
+ if (cropHint.left < 0) {
+ cropHint.left = 0;
+ }
+ if (cropHint.top < 0) {
+ cropHint.top = 0;
+ }
+
// Don't bother cropping if what we're left with is identity
needCrop = (options.outHeight > cropHint.height()
- && options.outWidth > cropHint.width());
+ || options.outWidth > cropHint.width());
}
// scale if the crop height winds up not matching the recommended metrics
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index c77e572..f5ed9d1 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -153,9 +153,9 @@
}
void destroyInTransaction() {
- // if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
- Slog.i(TAG, "Destroying surface " + this + " called by " + Debug.getCallers(8));
- // }
+ if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) {
+ Slog.i(TAG, "Destroying surface " + this + " called by " + Debug.getCallers(8));
+ }
try {
if (mSurfaceControl != null) {
mSurfaceControl.destroy();
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index a093d54..2eb37df 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -327,7 +327,7 @@
*
* @hide
*/
- public static final int PROPERTY_SHOW_CALLBACK_NUMBER = 1<<0;
+ public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 1<<0;
/**
* Whether the call is a generic conference, where we do not know the precise state of
@@ -655,8 +655,8 @@
builder.append("Properties:");
}
- if (can(properties, PROPERTY_SHOW_CALLBACK_NUMBER)) {
- builder.append(isLong ? " PROPERTY_SHOW_CALLBACK_NUMBER" : " clbk");
+ if (can(properties, PROPERTY_EMERGENCY_CALLBACK_MODE)) {
+ builder.append(isLong ? " PROPERTY_EMERGENCY_CALLBACK_MODE" : " ecbm");
}
if (can(properties, PROPERTY_HIGH_DEF_AUDIO)) {