Skip to content

Commit

Permalink
Merge tag 'android-8.1.0_r20' into HEAD
Browse files Browse the repository at this point in the history
Android 8.1.0 release 20
  • Loading branch information
The-DarkBeast committed Apr 8, 2018
2 parents 8eb05e7 + 65ff524 commit e5f8199
Show file tree
Hide file tree
Showing 32 changed files with 355 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private PeriodicAdvertisingReport(Parcel in) {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(syncHandle);
dest.writeLong(txPower);
dest.writeInt(txPower);
dest.writeInt(rssi);
dest.writeInt(dataStatus);
if (data != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ public OutputConfiguration(@NonNull OutputConfiguration other) {
this.mConfiguredSize = other.mConfiguredSize;
this.mConfiguredGenerationId = other.mConfiguredGenerationId;
this.mIsDeferredConfig = other.mIsDeferredConfig;
this.mIsShared = other.mIsShared;
}

/**
Expand All @@ -421,6 +422,7 @@ private OutputConfiguration(@NonNull Parcel source) {
int width = source.readInt();
int height = source.readInt();
boolean isDeferred = source.readInt() == 1;
boolean isShared = source.readInt() == 1;
ArrayList<Surface> surfaces = new ArrayList<Surface>();
source.readTypedList(surfaces, Surface.CREATOR);

Expand All @@ -431,6 +433,7 @@ private OutputConfiguration(@NonNull Parcel source) {
mSurfaces = surfaces;
mConfiguredSize = new Size(width, height);
mIsDeferredConfig = isDeferred;
mIsShared = isShared;
mSurfaces = surfaces;
if (mSurfaces.size() > 0) {
mSurfaceType = SURFACE_TYPE_UNKNOWN;
Expand Down
8 changes: 8 additions & 0 deletions core/java/android/net/Uri.java
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ static String parseAuthority(String uriString, int ssi) {
LOOP: while (end < length) {
switch (uriString.charAt(end)) {
case '/': // Start of path
case '\\':// Start of path
// Per http://url.spec.whatwg.org/#host-state, the \ character
// is treated as if it were a / character when encountered in a
// host
case '?': // Start of query
case '#': // Start of fragment
break LOOP;
Expand Down Expand Up @@ -758,6 +762,10 @@ static String parsePath(String uriString, int ssi) {
case '#': // Start of fragment
return ""; // Empty path.
case '/': // Start of path!
case '\\':// Start of path!
// Per http://url.spec.whatwg.org/#host-state, the \ character
// is treated as if it were a / character when encountered in a
// host
break LOOP;
}
pathStart++;
Expand Down
6 changes: 6 additions & 0 deletions core/java/android/provider/CallLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ public static class Calls implements BaseColumns {
/** Call was WIFI call. */
public static final int FEATURES_WIFI = 0x8;

/**
* Indicates the call underwent Assisted Dialing.
* @hide
*/
public static final Integer FEATURES_ASSISTED_DIALING_USED = 0x10;

/**
* The phone number as the user entered it.
* <P>Type: TEXT</P>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ public class Tonal implements ExtractionType {

private static final boolean DEBUG = true;

public static final int THRESHOLD_COLOR_LIGHT = 0xffe0e0e0;
public static final int MAIN_COLOR_LIGHT = 0xffe0e0e0;
public static final int SECONDARY_COLOR_LIGHT = 0xff9e9e9e;
public static final int MAIN_COLOR_DARK = 0xff212121;
public static final int THRESHOLD_COLOR_DARK = 0xff212121;
public static final int MAIN_COLOR_DARK = 0xff000000;
public static final int SECONDARY_COLOR_DARK = 0xff000000;

private final TonalPalette mGreyPalette;
Expand Down Expand Up @@ -197,12 +199,12 @@ private boolean runTonalExtraction(@Nullable WallpaperColors inWallpaperColors,
// light fallback or darker than our dark fallback.
ColorUtils.colorToHSL(mainColor, mTmpHSL);
final float mainLuminosity = mTmpHSL[2];
ColorUtils.colorToHSL(MAIN_COLOR_LIGHT, mTmpHSL);
ColorUtils.colorToHSL(THRESHOLD_COLOR_LIGHT, mTmpHSL);
final float lightLuminosity = mTmpHSL[2];
if (mainLuminosity > lightLuminosity) {
return false;
}
ColorUtils.colorToHSL(MAIN_COLOR_DARK, mTmpHSL);
ColorUtils.colorToHSL(THRESHOLD_COLOR_DARK, mTmpHSL);
final float darkLuminosity = mTmpHSL[2];
if (mainLuminosity < darkLuminosity) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public void writeToParcel(Parcel dest, int flags) {
if (mPayload != null) {
dest.writeInt(mPayload.length);
dest.writeByteArray(mPayload);
} else {
dest.writeInt(0);
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions core/proto/android/service/diskstats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ message DiskStatsServiceDumpProto {
}

message DiskStatsCachedValuesProto {
// Total app data size, in kilobytes
// Total app code size, in kilobytes
int64 agg_apps_size = 1;
// Total app cache size, in kilobytes
int64 agg_apps_cache_size = 2;
Expand All @@ -65,15 +65,19 @@ message DiskStatsCachedValuesProto {
int64 other_size = 8;
// Sizes of individual packages
repeated DiskStatsAppSizesProto app_sizes = 9;
// Total app data size, in kilobytes
int64 agg_apps_data_size = 10;
}

message DiskStatsAppSizesProto {
// Name of the package
string package_name = 1;
// App's data size in kilobytes
// App's code size in kilobytes
int64 app_size = 2;
// App's cache size in kilobytes
int64 cache_size = 3;
// App's data size in kilobytes
int64 app_data_size = 4;
}

message DiskStatsFreeSpaceProto {
Expand Down
6 changes: 6 additions & 0 deletions core/tests/coretests/src/android/net/UriTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ public void testAuthorityParsing() {
assertEquals("a:[email protected]:[email protected]", uri.getAuthority());
assertEquals("example2.com", uri.getHost());
assertEquals(-1, uri.getPort());
assertEquals("/path", uri.getPath());

uri = Uri.parse("http://a.foo.com\\.example.com/path");
assertEquals("a.foo.com", uri.getHost());
assertEquals(-1, uri.getPort());
assertEquals("\\.example.com/path", uri.getPath());
}

@SmallTest
Expand Down
8 changes: 7 additions & 1 deletion libs/androidfw/ResourceTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,13 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const
*outLen = encLen;

if ((uint32_t)(str+encLen-strings) < mStringPoolSize) {
return (const char*)str;
// Reject malformed (non null-terminated) strings
if (str[encLen] != 0x00) {
ALOGW("Bad string block: string #%d is not null-terminated",
(int)idx);
return NULL;
}
return (const char*)str;
} else {
ALOGW("Bad string block: string #%d extends to %d, past end at %d\n",
(int)idx, (int)(str+encLen-strings), (int)mStringPoolSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1687,18 +1687,9 @@ private Set<String> getOverlayInstantAppAccessibleSettings(int settingsType) {
}

private List<String> getSettingsNamesLocked(int settingsType, int userId) {
boolean instantApp;
if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
instantApp = false;
} else {
ApplicationInfo ai = getCallingApplicationInfoOrThrow();
instantApp = ai.isInstantApp();
}
if (instantApp) {
return new ArrayList<String>(getInstantAppAccessibleSettings(settingsType));
} else {
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
}
// Don't enforce the instant app whitelist for now -- its too prone to unintended breakage
// in the current form.
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
}

private void enforceSettingReadable(String settingName, int settingsType, int userId) {
Expand All @@ -1711,8 +1702,10 @@ private void enforceSettingReadable(String settingName, int settingsType, int us
}
if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)
&& !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) {
throw new SecurityException("Setting " + settingName + " is not accessible from"
+ " ephemeral package " + getCallingPackage());
// Don't enforce the instant app whitelist for now -- its too prone to unintended
// breakage in the current form.
Slog.w(LOG_TAG, "Instant App " + ai.packageName
+ " trying to access unexposed setting, this will be an error in the future.");
}
}

Expand Down
35 changes: 34 additions & 1 deletion proto/src/metrics_constants.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4536,7 +4536,8 @@ message MetricsEvent {
// OS: O MR
AUTOFILL_SERVICE_DISABLED_SELF = 1135;

// Counter showing how long it took (in ms) to show the autofill UI after a field was focused
// Reports how long it took to show the autofill UI after a field was focused
// Tag FIELD_AUTOFILL_DURATION: Duration in ms
// Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request
// Package: Package of the autofill service
// OS: O MR
Expand Down Expand Up @@ -4571,8 +4572,40 @@ message MetricsEvent {
// OS: O MR
COLOR_MODE_SETTINGS = 1143;

// Enclosing category for group of APP_TRANSITION_FOO events,
// logged when we cancel an app transition.
APP_TRANSITION_CANCELLED = 1144;

// Tag of a field representing a duration on autofill-related metrics.
FIELD_AUTOFILL_DURATION = 1145;

// ---- End O-MR1 Constants, all O-MR1 constants go above this line ----

// ACTION: Stop an app and turn on background check
// CATEGORY: SETTINGS
// OS: P
ACTION_APP_STOP_AND_BACKGROUND_CHECK = 1233;

// FIELD: The action type for each anomaly
// CATEGORY: SETTINGS
// OS: P
FIELD_ANOMALY_ACTION_TYPE = 1234;

// OPEN: Settings -> Battery -> Wakelock anomaly
// CATEGORY: SETTINGS
// OS: P
ANOMALY_TYPE_WAKELOCK = 1235;

// OPEN: Settings -> Battery -> Wakeup alarm anomaly
// CATEGORY: SETTINGS
// OS: P
ANOMALY_TYPE_WAKEUP_ALARM = 1236;

// OPEN: Settings -> Battery -> Unoptimized bt anomaly
// CATEGORY: SETTINGS
// OS: P
ANOMALY_TYPE_UNOPTIMIZED_BT = 1237;

// Add new aosp constants above this line.
// END OF AOSP CONSTANTS

Expand Down
35 changes: 35 additions & 0 deletions proto/src/wifi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,34 @@ message WifiLog {

// Count of connection attempts that were initiated unsuccessfully
optional int32 num_open_network_connect_message_failed_to_send = 82;

// Histogram counting instances of scans with N many HotSpot 2.0 R1 APs
repeated NumConnectableNetworksBucket observed_hotspot_r1_aps_in_scan_histogram = 83;

// Histogram counting instances of scans with N many HotSpot 2.0 R2 APs
repeated NumConnectableNetworksBucket observed_hotspot_r2_aps_in_scan_histogram = 84;

// Histogram counting instances of scans with N many unique HotSpot 2.0 R1 ESS.
// Where ESS is defined as the (HESSID, ANQP Domain ID), (SSID, ANQP Domain ID) or
// (SSID, BSSID) tuple depending on AP configuration (in the above priority
// order).
repeated NumConnectableNetworksBucket observed_hotspot_r1_ess_in_scan_histogram = 85;

// Histogram counting instances of scans with N many unique HotSpot 2.0 R2 ESS.
// Where ESS is defined as the (HESSID, ANQP Domain ID), (SSID, ANQP Domain ID) or
// (SSID, BSSID) tuple depending on AP configuration (in the above priority
// order).
repeated NumConnectableNetworksBucket observed_hotspot_r2_ess_in_scan_histogram = 86;

// Histogram counting number of HotSpot 2.0 R1 APs per observed ESS in a scan
// (one value added per unique ESS - potentially multiple counts per single
// scan!)
repeated NumConnectableNetworksBucket observed_hotspot_r1_aps_per_ess_in_scan_histogram = 87;

// Histogram counting number of HotSpot 2.0 R2 APs per observed ESS in a scan
// (one value added per unique ESS - potentially multiple counts per single
// scan!)
repeated NumConnectableNetworksBucket observed_hotspot_r2_aps_per_ess_in_scan_histogram = 88;
}

// Information that gets logged for every WiFi connection.
Expand Down Expand Up @@ -645,6 +673,10 @@ message StaEvent {
// Framework initiated disconnect. Sometimes generated to give an extra reason for a disconnect
// Should typically be followed by a NETWORK_DISCONNECTION_EVENT with a local_gen = true
TYPE_FRAMEWORK_DISCONNECT = 15;

// The NetworkAgent score for wifi has changed in a way that may impact
// connectivity
TYPE_SCORE_BREACH = 16;
}

enum FrameworkDisconnectReason {
Expand Down Expand Up @@ -756,6 +788,9 @@ message StaEvent {

// Authentication failure reason, as reported by WifiManager (calculated from state & deauth code)
optional AuthFailureReason auth_failure_reason = 13 [default = AUTH_FAILURE_UNKNOWN];

// NetworkAgent score of connected wifi
optional int32 last_score = 14 [default = -1];
}

// Wi-Fi Aware metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,7 @@ public void onFillReady(FillResponse response, AutofillId filledId,
mUiLatencyHistory.log(historyLog.toString());

final LogMaker metricsLog = newLogMaker(MetricsEvent.AUTOFILL_UI_LATENCY)
.setCounterValue((int) duration);
.addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, duration);
mMetricsLogger.write(metricsLog);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,8 @@ public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
public boolean isActiveNetworkMetered() {
enforceAccessPermission();

final NetworkCapabilities caps = getNetworkCapabilities(getActiveNetwork());
final int uid = Binder.getCallingUid();
final NetworkCapabilities caps = getUnfilteredActiveNetworkState(uid).networkCapabilities;
if (caps != null) {
return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
} else {
Expand Down
16 changes: 13 additions & 3 deletions services/core/java/com/android/server/DiskStatsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ private void reportCachedValues(PrintWriter pw) {
JSONObject json = new JSONObject(jsonString);
pw.print("App Size: ");
pw.println(json.getLong(DiskStatsFileLogger.APP_SIZE_AGG_KEY));
pw.print("App Data Size: ");
pw.println(json.getLong(DiskStatsFileLogger.APP_DATA_SIZE_AGG_KEY));
pw.print("App Cache Size: ");
pw.println(json.getLong(DiskStatsFileLogger.APP_CACHE_AGG_KEY));
pw.print("Photos Size: ");
Expand All @@ -220,6 +222,8 @@ private void reportCachedValues(PrintWriter pw) {
pw.println(json.getJSONArray(DiskStatsFileLogger.PACKAGE_NAMES_KEY));
pw.print("App Sizes: ");
pw.println(json.getJSONArray(DiskStatsFileLogger.APP_SIZES_KEY));
pw.print("App Data Sizes: ");
pw.println(json.getJSONArray(DiskStatsFileLogger.APP_DATA_KEY));
pw.print("Cache Sizes: ");
pw.println(json.getJSONArray(DiskStatsFileLogger.APP_CACHES_KEY));
} catch (IOException | JSONException e) {
Expand All @@ -235,6 +239,8 @@ private void reportCachedValuesProto(ProtoOutputStream proto) {

proto.write(DiskStatsCachedValuesProto.AGG_APPS_SIZE,
json.getLong(DiskStatsFileLogger.APP_SIZE_AGG_KEY));
proto.write(DiskStatsCachedValuesProto.AGG_APPS_DATA_SIZE,
json.getLong(DiskStatsFileLogger.APP_DATA_SIZE_AGG_KEY));
proto.write(DiskStatsCachedValuesProto.AGG_APPS_CACHE_SIZE,
json.getLong(DiskStatsFileLogger.APP_CACHE_AGG_KEY));
proto.write(DiskStatsCachedValuesProto.PHOTOS_SIZE,
Expand All @@ -252,22 +258,26 @@ private void reportCachedValuesProto(ProtoOutputStream proto) {

JSONArray packageNamesArray = json.getJSONArray(DiskStatsFileLogger.PACKAGE_NAMES_KEY);
JSONArray appSizesArray = json.getJSONArray(DiskStatsFileLogger.APP_SIZES_KEY);
JSONArray appDataSizesArray = json.getJSONArray(DiskStatsFileLogger.APP_DATA_KEY);
JSONArray cacheSizesArray = json.getJSONArray(DiskStatsFileLogger.APP_CACHES_KEY);
final int len = packageNamesArray.length();
if (len == appSizesArray.length() && len == cacheSizesArray.length()) {
if (len == appSizesArray.length()
&& len == appDataSizesArray.length()
&& len == cacheSizesArray.length()) {
for (int i = 0; i < len; i++) {
long packageToken = proto.start(DiskStatsCachedValuesProto.APP_SIZES);

proto.write(DiskStatsAppSizesProto.PACKAGE_NAME,
packageNamesArray.getString(i));
proto.write(DiskStatsAppSizesProto.APP_SIZE, appSizesArray.getLong(i));
proto.write(DiskStatsAppSizesProto.APP_DATA_SIZE, appDataSizesArray.getLong(i));
proto.write(DiskStatsAppSizesProto.CACHE_SIZE, cacheSizesArray.getLong(i));

proto.end(packageToken);
}
} else {
Slog.wtf(TAG, "Sizes of packageNamesArray, appSizesArray and cacheSizesArray "
+ "are not the same");
Slog.wtf(TAG, "Sizes of packageNamesArray, appSizesArray, appDataSizesArray "
+ " and cacheSizesArray are not the same");
}

proto.end(cachedValuesToken);
Expand Down
4 changes: 2 additions & 2 deletions services/core/java/com/android/server/am/ActiveServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -1043,8 +1043,8 @@ private void setServiceForegroundInnerLocked(ServiceRecord r, int id,
try {
if (AppGlobals.getPackageManager().checkPermission(
android.Manifest.permission.INSTANT_APP_FOREGROUND_SERVICE,
r.appInfo.packageName,
r.appInfo.uid) != PackageManager.PERMISSION_GRANTED) {
r.appInfo.packageName, UserHandle.getUserId(r.appInfo.uid))
!= PackageManager.PERMISSION_GRANTED) {
throw new SecurityException("Instant app " + r.appInfo.packageName
+ " does not have permission to create foreground"
+ "services");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class ActivityManagerDebugConfig {
static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
static final boolean DEBUG_PERMISSIONS_REVIEW = DEBUG_ALL || false;
static final boolean DEBUG_WHITELISTS = DEBUG_ALL || false;
static final boolean DEBUG_METRICS = DEBUG_ALL || false;

static final String POSTFIX_ADD_REMOVE = (APPEND_CATEGORY_NAME) ? "_AddRemove" : "";
static final String POSTFIX_APP = (APPEND_CATEGORY_NAME) ? "_App" : "";
Expand Down
Loading

0 comments on commit e5f8199

Please sign in to comment.