Merge "Incremental native lib extraction"
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index 69f4748..939164e 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -494,9 +494,10 @@
private static final String DEPRECATED_KEY_BG_LOW_JOB_COUNT = "bg_low_job_count";
private static final String DEPRECATED_KEY_BG_CRITICAL_JOB_COUNT = "bg_critical_job_count";
- private static final String KEY_MAX_STANDARD_RESCHEDULE_COUNT
+ private static final String DEPRECATED_KEY_MAX_STANDARD_RESCHEDULE_COUNT
= "max_standard_reschedule_count";
- private static final String KEY_MAX_WORK_RESCHEDULE_COUNT = "max_work_reschedule_count";
+ private static final String DEPRECATED_KEY_MAX_WORK_RESCHEDULE_COUNT =
+ "max_work_reschedule_count";
private static final String KEY_MIN_LINEAR_BACKOFF_TIME = "min_linear_backoff_time";
private static final String KEY_MIN_EXP_BACKOFF_TIME = "min_exp_backoff_time";
private static final String DEPRECATED_KEY_STANDBY_HEARTBEAT_TIME =
@@ -525,8 +526,6 @@
private static final long DEFAULT_MAX_NON_ACTIVE_JOB_BATCH_DELAY_MS = 31 * MINUTE_IN_MILLIS;
private static final float DEFAULT_HEAVY_USE_FACTOR = .9f;
private static final float DEFAULT_MODERATE_USE_FACTOR = .5f;
- private static final int DEFAULT_MAX_STANDARD_RESCHEDULE_COUNT = Integer.MAX_VALUE;
- private static final int DEFAULT_MAX_WORK_RESCHEDULE_COUNT = Integer.MAX_VALUE;
private static final long DEFAULT_MIN_LINEAR_BACKOFF_TIME = JobInfo.MIN_BACKOFF_MILLIS;
private static final long DEFAULT_MIN_EXP_BACKOFF_TIME = JobInfo.MIN_BACKOFF_MILLIS;
private static final float DEFAULT_CONN_CONGESTION_DELAY_FRAC = 0.5f;
@@ -640,16 +639,6 @@
"screen_off_job_concurrency_increase_delay_ms", 30_000);
/**
- * The maximum number of times we allow a job to have itself rescheduled before
- * giving up on it, for standard jobs.
- */
- int MAX_STANDARD_RESCHEDULE_COUNT = DEFAULT_MAX_STANDARD_RESCHEDULE_COUNT;
- /**
- * The maximum number of times we allow a job to have itself rescheduled before
- * giving up on it, for jobs that are executing work.
- */
- int MAX_WORK_RESCHEDULE_COUNT = DEFAULT_MAX_WORK_RESCHEDULE_COUNT;
- /**
* The minimum backoff time to allow for linear backoff.
*/
long MIN_LINEAR_BACKOFF_TIME = DEFAULT_MIN_LINEAR_BACKOFF_TIME;
@@ -735,10 +724,6 @@
SCREEN_OFF_JOB_CONCURRENCY_INCREASE_DELAY_MS.parse(mParser);
- MAX_STANDARD_RESCHEDULE_COUNT = mParser.getInt(KEY_MAX_STANDARD_RESCHEDULE_COUNT,
- DEFAULT_MAX_STANDARD_RESCHEDULE_COUNT);
- MAX_WORK_RESCHEDULE_COUNT = mParser.getInt(KEY_MAX_WORK_RESCHEDULE_COUNT,
- DEFAULT_MAX_WORK_RESCHEDULE_COUNT);
MIN_LINEAR_BACKOFF_TIME = mParser.getDurationMillis(KEY_MIN_LINEAR_BACKOFF_TIME,
DEFAULT_MIN_LINEAR_BACKOFF_TIME);
MIN_EXP_BACKOFF_TIME = mParser.getDurationMillis(KEY_MIN_EXP_BACKOFF_TIME,
@@ -790,8 +775,6 @@
SCREEN_OFF_JOB_CONCURRENCY_INCREASE_DELAY_MS.dump(pw, "");
- pw.printPair(KEY_MAX_STANDARD_RESCHEDULE_COUNT, MAX_STANDARD_RESCHEDULE_COUNT).println();
- pw.printPair(KEY_MAX_WORK_RESCHEDULE_COUNT, MAX_WORK_RESCHEDULE_COUNT).println();
pw.printPair(KEY_MIN_LINEAR_BACKOFF_TIME, MIN_LINEAR_BACKOFF_TIME).println();
pw.printPair(KEY_MIN_EXP_BACKOFF_TIME, MIN_EXP_BACKOFF_TIME).println();
pw.printPair(KEY_CONN_CONGESTION_DELAY_FRAC, CONN_CONGESTION_DELAY_FRAC).println();
@@ -827,8 +810,6 @@
SCREEN_OFF_JOB_CONCURRENCY_INCREASE_DELAY_MS.dumpProto(proto,
ConstantsProto.SCREEN_OFF_JOB_CONCURRENCY_INCREASE_DELAY_MS);
- proto.write(ConstantsProto.MAX_STANDARD_RESCHEDULE_COUNT, MAX_STANDARD_RESCHEDULE_COUNT);
- proto.write(ConstantsProto.MAX_WORK_RESCHEDULE_COUNT, MAX_WORK_RESCHEDULE_COUNT);
proto.write(ConstantsProto.MIN_LINEAR_BACKOFF_TIME_MS, MIN_LINEAR_BACKOFF_TIME);
proto.write(ConstantsProto.MIN_EXP_BACKOFF_TIME_MS, MIN_EXP_BACKOFF_TIME);
proto.write(ConstantsProto.CONN_CONGESTION_DELAY_FRAC, CONN_CONGESTION_DELAY_FRAC);
@@ -1390,18 +1371,8 @@
// Effective standby bucket can change after this in some situations so use
// the real bucket so that the job is tracked by the controllers.
if (js.getStandbyBucket() == RESTRICTED_INDEX) {
- js.addDynamicConstraint(JobStatus.CONSTRAINT_BATTERY_NOT_LOW);
- js.addDynamicConstraint(JobStatus.CONSTRAINT_CHARGING);
- js.addDynamicConstraint(JobStatus.CONSTRAINT_CONNECTIVITY);
- js.addDynamicConstraint(JobStatus.CONSTRAINT_IDLE);
-
mRestrictiveControllers.get(j).startTrackingRestrictedJobLocked(js);
} else {
- js.removeDynamicConstraint(JobStatus.CONSTRAINT_BATTERY_NOT_LOW);
- js.removeDynamicConstraint(JobStatus.CONSTRAINT_CHARGING);
- js.removeDynamicConstraint(JobStatus.CONSTRAINT_CONNECTIVITY);
- js.removeDynamicConstraint(JobStatus.CONSTRAINT_IDLE);
-
mRestrictiveControllers.get(j).stopTrackingRestrictedJobLocked(js);
}
}
@@ -1738,19 +1709,6 @@
final int backoffAttempts = failureToReschedule.getNumFailures() + 1;
long delayMillis;
- if (failureToReschedule.hasWorkLocked()) {
- if (backoffAttempts > mConstants.MAX_WORK_RESCHEDULE_COUNT) {
- Slog.w(TAG, "Not rescheduling " + failureToReschedule + ": attempt #"
- + backoffAttempts + " > work limit "
- + mConstants.MAX_STANDARD_RESCHEDULE_COUNT);
- return null;
- }
- } else if (backoffAttempts > mConstants.MAX_STANDARD_RESCHEDULE_COUNT) {
- Slog.w(TAG, "Not rescheduling " + failureToReschedule + ": attempt #"
- + backoffAttempts + " > std limit " + mConstants.MAX_STANDARD_RESCHEDULE_COUNT);
- return null;
- }
-
switch (job.getBackoffPolicy()) {
case JobInfo.BACKOFF_POLICY_LINEAR: {
long backoff = initialBackoffMillis;
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java
index f706260..1e89158 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/JobStatus.java
@@ -17,6 +17,8 @@
package com.android.server.job.controllers;
import static com.android.server.job.JobSchedulerService.ACTIVE_INDEX;
+import static com.android.server.job.JobSchedulerService.NEVER_INDEX;
+import static com.android.server.job.JobSchedulerService.RESTRICTED_INDEX;
import static com.android.server.job.JobSchedulerService.sElapsedRealtimeClock;
import android.app.AppGlobals;
@@ -63,26 +65,36 @@
* @hide
*/
public final class JobStatus {
- static final String TAG = "JobSchedulerService";
+ private static final String TAG = "JobScheduler.JobStatus";
static final boolean DEBUG = JobSchedulerService.DEBUG;
public static final long NO_LATEST_RUNTIME = Long.MAX_VALUE;
public static final long NO_EARLIEST_RUNTIME = 0L;
- public static final int CONSTRAINT_CHARGING = JobInfo.CONSTRAINT_FLAG_CHARGING; // 1 < 0
- public static final int CONSTRAINT_IDLE = JobInfo.CONSTRAINT_FLAG_DEVICE_IDLE; // 1 << 2
- public static final int CONSTRAINT_BATTERY_NOT_LOW =
- JobInfo.CONSTRAINT_FLAG_BATTERY_NOT_LOW; // 1 << 1
+ static final int CONSTRAINT_CHARGING = JobInfo.CONSTRAINT_FLAG_CHARGING; // 1 < 0
+ static final int CONSTRAINT_IDLE = JobInfo.CONSTRAINT_FLAG_DEVICE_IDLE; // 1 << 2
+ static final int CONSTRAINT_BATTERY_NOT_LOW = JobInfo.CONSTRAINT_FLAG_BATTERY_NOT_LOW; // 1 << 1
static final int CONSTRAINT_STORAGE_NOT_LOW = JobInfo.CONSTRAINT_FLAG_STORAGE_NOT_LOW; // 1 << 3
static final int CONSTRAINT_TIMING_DELAY = 1<<31;
static final int CONSTRAINT_DEADLINE = 1<<30;
- public static final int CONSTRAINT_CONNECTIVITY = 1 << 28;
+ static final int CONSTRAINT_CONNECTIVITY = 1 << 28;
static final int CONSTRAINT_CONTENT_TRIGGER = 1<<26;
static final int CONSTRAINT_DEVICE_NOT_DOZING = 1 << 25; // Implicit constraint
static final int CONSTRAINT_WITHIN_QUOTA = 1 << 24; // Implicit constraint
static final int CONSTRAINT_BACKGROUND_NOT_RESTRICTED = 1 << 22; // Implicit constraint
/**
+ * The additional set of dynamic constraints that must be met if the job's effective bucket is
+ * {@link JobSchedulerService#RESTRICTED_INDEX}. Connectivity can be ignored if the job doesn't
+ * need network.
+ */
+ private static final int DYNAMIC_RESTRICTED_CONSTRAINTS =
+ CONSTRAINT_BATTERY_NOT_LOW
+ | CONSTRAINT_CHARGING
+ | CONSTRAINT_CONNECTIVITY
+ | CONSTRAINT_IDLE;
+
+ /**
* The constraints that we want to log to statsd.
*
* Constraints that can be inferred from other atoms have been excluded to avoid logging too
@@ -419,7 +431,11 @@
this.requiredConstraints = requiredConstraints;
mRequiredConstraintsOfInterest = requiredConstraints & CONSTRAINTS_OF_INTEREST;
mReadyNotDozing = (job.getFlags() & JobInfo.FLAG_WILL_BE_FOREGROUND) != 0;
- mReadyDynamicSatisfied = true;
+ if (standbyBucket == RESTRICTED_INDEX) {
+ addDynamicConstraints(DYNAMIC_RESTRICTED_CONSTRAINTS);
+ } else {
+ mReadyDynamicSatisfied = true;
+ }
mLastSuccessfulRunTime = lastSuccessfulRunTime;
mLastFailedRunTime = lastFailedRunTime;
@@ -727,6 +743,14 @@
}
public void setStandbyBucket(int newBucket) {
+ if (newBucket == RESTRICTED_INDEX) {
+ // Adding to the bucket.
+ addDynamicConstraints(DYNAMIC_RESTRICTED_CONSTRAINTS);
+ } else if (standbyBucket == RESTRICTED_INDEX) {
+ // Removing from the RESTRICTED bucket.
+ removeDynamicConstraints(DYNAMIC_RESTRICTED_CONSTRAINTS);
+ }
+
standbyBucket = newBucket;
}
@@ -1054,6 +1078,11 @@
if (old == state) {
return false;
}
+ if (DEBUG) {
+ Slog.v(TAG,
+ "Constraint " + constraint + " is " + (!state ? "NOT " : "") + "satisfied for "
+ + toShortString());
+ }
satisfiedConstraints = (satisfiedConstraints&~constraint) | (state ? constraint : 0);
mSatisfiedConstraintsOfInterest = satisfiedConstraints & CONSTRAINTS_OF_INTEREST;
mReadyDynamicSatisfied =
@@ -1086,38 +1115,40 @@
}
/**
- * Indicates that this job cannot run without the specified constraint. This is evaluated
+ * Indicates that this job cannot run without the specified constraints. This is evaluated
* separately from the job's explicitly requested constraints and MUST be satisfied before
* the job can run if the app doesn't have quota.
- *
*/
- public void addDynamicConstraint(int constraint) {
- if (constraint == CONSTRAINT_WITHIN_QUOTA) {
+ private void addDynamicConstraints(int constraints) {
+ if ((constraints & CONSTRAINT_WITHIN_QUOTA) != 0) {
+ // Quota should never be used as a dynamic constraint.
Slog.wtf(TAG, "Tried to set quota as a dynamic constraint");
- return;
+ constraints &= ~CONSTRAINT_WITHIN_QUOTA;
}
// Connectivity and content trigger are special since they're only valid to add if the
// job has requested network or specific content URIs. Adding these constraints to jobs
// that don't need them doesn't make sense.
- if ((constraint == CONSTRAINT_CONNECTIVITY && !hasConnectivityConstraint())
- || (constraint == CONSTRAINT_CONTENT_TRIGGER && !hasContentTriggerConstraint())) {
- return;
+ if (!hasConnectivityConstraint()) {
+ constraints &= ~CONSTRAINT_CONNECTIVITY;
+ }
+ if (!hasContentTriggerConstraint()) {
+ constraints &= ~CONSTRAINT_CONTENT_TRIGGER;
}
- mDynamicConstraints |= constraint;
+ mDynamicConstraints |= constraints;
mReadyDynamicSatisfied =
mDynamicConstraints == (satisfiedConstraints & mDynamicConstraints);
}
/**
- * Removes a dynamic constraint from a job, meaning that the requirement is not required for
+ * Removes dynamic constraints from a job, meaning that the requirements are not required for
* the job to run (if the job itself hasn't requested the constraint. This is separate from
* the job's explicitly requested constraints and does not remove those requested constraints.
*
*/
- public void removeDynamicConstraint(int constraint) {
- mDynamicConstraints &= ~constraint;
+ private void removeDynamicConstraints(int constraints) {
+ mDynamicConstraints &= ~constraints;
mReadyDynamicSatisfied =
mDynamicConstraints == (satisfiedConstraints & mDynamicConstraints);
}
@@ -1193,7 +1224,11 @@
private boolean isReady(int satisfiedConstraints) {
// Quota and dynamic constraints trump all other constraints.
- if (!mReadyWithinQuota && !mReadyDynamicSatisfied) {
+ // NEVER jobs are not supposed to run at all. Since we're using quota to allow parole
+ // sessions (exempt from dynamic restrictions), we need the additional check to ensure
+ // that NEVER jobs don't run.
+ // TODO: cleanup quota and standby bucket management so we don't need the additional checks
+ if ((!mReadyWithinQuota && !mReadyDynamicSatisfied) || standbyBucket == NEVER_INDEX) {
return false;
}
// Deadline constraint trumps other constraints besides quota and dynamic (except for
diff --git a/api/current.txt b/api/current.txt
index e3b557d..fb73f2a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4015,7 +4015,7 @@
method public android.util.Size getAppTaskThumbnailSize();
method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
- method @Nullable public java.util.List<android.app.ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String, @IntRange(from=0) int, @IntRange(from=0) int);
+ method @NonNull public java.util.List<android.app.ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String, @IntRange(from=0) int, @IntRange(from=0) int);
method public int getLargeMemoryClass();
method public int getLauncherLargeIconDensity();
method public int getLauncherLargeIconSize();
@@ -4555,12 +4555,13 @@
method public int getPackageUid();
method public int getPid();
method @NonNull public String getProcessName();
- method public int getPss();
+ method public long getPss();
method public int getRealUid();
method public int getReason();
- method public int getRss();
+ method public long getRss();
method public int getStatus();
method public long getTimestamp();
+ method @NonNull public android.os.UserHandle getUserHandle();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationExitInfo> CREATOR;
field public static final int REASON_ANR = 6; // 0x6
diff --git a/api/system-current.txt b/api/system-current.txt
index eaa7112..bf87e55 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -585,10 +585,6 @@
field @NonNull public static final android.os.Parcelable.Creator<android.app.AppOpsManager.PackageOps> CREATOR;
}
- public final class ApplicationExitInfo implements android.os.Parcelable {
- method @NonNull public android.os.UserHandle getUserHandle();
- }
-
public class BroadcastOptions {
method public static android.app.BroadcastOptions makeBasic();
method @RequiresPermission("android.permission.START_ACTIVITIES_FROM_BACKGROUND") public void setBackgroundActivityStartsAllowed(boolean);
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 7e069a6..70f309a 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -124,6 +124,7 @@
"libstatslog",
"libstatsmetadata",
"libsysutils",
+ "libutils",
],
shared_libs: [
"libbinder",
@@ -131,7 +132,6 @@
"liblog",
"libservices",
"libstatssocket",
- "libutils",
],
}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index db9aa18..7ee4405 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -94,6 +94,7 @@
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Locale;
@@ -3555,13 +3556,13 @@
* @return a list of {@link ApplicationExitInfo} records matching the criteria, sorted in
* the order from most recent to least recent.
*/
- @Nullable
+ @NonNull
public List<ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String packageName,
@IntRange(from = 0) int pid, @IntRange(from = 0) int maxNum) {
try {
ParceledListSlice<ApplicationExitInfo> r = getService().getHistoricalProcessExitReasons(
packageName, pid, maxNum, mContext.getUserId());
- return r == null ? null : r.getList();
+ return r == null ? Collections.emptyList() : r.getList();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/app/ApplicationExitInfo.java b/core/java/android/app/ApplicationExitInfo.java
index 4bf5f07..c55453e 100644
--- a/core/java/android/app/ApplicationExitInfo.java
+++ b/core/java/android/app/ApplicationExitInfo.java
@@ -19,7 +19,6 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.annotation.SystemApi;
import android.app.ActivityManager.RunningAppProcessInfo.Importance;
import android.icu.text.SimpleDateFormat;
import android.os.Parcel;
@@ -245,12 +244,12 @@
/**
* @see {@link #getPss}
*/
- private int mPss;
+ private long mPss;
/**
* @see {@link #getRss}
*/
- private int mRss;
+ private long mRss;
/**
* @see {@link #getTimestamp}
@@ -385,7 +384,7 @@
* it's NOT the exact memory information prior to its death; and it'll be zero
* if the process died before system had a chance to take the sample. </p>
*/
- public int getPss() {
+ public long getPss() {
return mPss;
}
@@ -396,12 +395,13 @@
* it's NOT the exact memory information prior to its death; and it'll be zero
* if the process died before system had a chance to take the sample. </p>
*/
- public int getRss() {
+ public long getRss() {
return mRss;
}
/**
- * The timestamp of the process's death, in milliseconds since the epoch.
+ * The timestamp of the process's death, in milliseconds since the epoch,
+ * as returned by {@link System#currentTimeMillis System.currentTimeMillis()}.
*/
public long getTimestamp() {
return mTimestamp;
@@ -409,6 +409,9 @@
/**
* The human readable description of the process's death, given by the system; could be null.
+ *
+ * <p class="note">Note: only intended to be human-readable and the system provides no
+ * guarantees that the format is stable across devices or Android releases.</p>
*/
public @Nullable String getDescription() {
return mDescription;
@@ -416,10 +419,7 @@
/**
* Return the user id of the record on a multi-user system.
- *
- * @hide
*/
- @SystemApi
public @NonNull UserHandle getUserHandle() {
return UserHandle.of(UserHandle.getUserId(mRealUid));
}
@@ -546,7 +546,7 @@
*
* @hide
*/
- public void setPss(final int pss) {
+ public void setPss(final long pss) {
mPss = pss;
}
@@ -555,7 +555,7 @@
*
* @hide
*/
- public void setRss(final int rss) {
+ public void setRss(final long rss) {
mRss = rss;
}
@@ -630,8 +630,8 @@
dest.writeInt(mSubReason);
dest.writeInt(mStatus);
dest.writeInt(mImportance);
- dest.writeInt(mPss);
- dest.writeInt(mRss);
+ dest.writeLong(mPss);
+ dest.writeLong(mRss);
dest.writeLong(mTimestamp);
dest.writeString(mDescription);
}
@@ -669,8 +669,8 @@
mSubReason = in.readInt();
mStatus = in.readInt();
mImportance = in.readInt();
- mPss = in.readInt();
- mRss = in.readInt();
+ mPss = in.readLong();
+ mRss = in.readLong();
mTimestamp = in.readLong();
mDescription = in.readString();
}
@@ -848,10 +848,10 @@
mImportance = proto.readInt(ApplicationExitInfoProto.IMPORTANCE);
break;
case (int) ApplicationExitInfoProto.PSS:
- mPss = proto.readInt(ApplicationExitInfoProto.PSS);
+ mPss = proto.readLong(ApplicationExitInfoProto.PSS);
break;
case (int) ApplicationExitInfoProto.RSS:
- mRss = proto.readInt(ApplicationExitInfoProto.RSS);
+ mRss = proto.readLong(ApplicationExitInfoProto.RSS);
break;
case (int) ApplicationExitInfoProto.TIMESTAMP:
mTimestamp = proto.readLong(ApplicationExitInfoProto.TIMESTAMP);
@@ -891,8 +891,8 @@
result = 31 * result + mSubReason;
result = 31 * result + mImportance;
result = 31 * result + mStatus;
- result = 31 * result + mPss;
- result = 31 * result + mRss;
+ result = 31 * result + (int) mPss;
+ result = 31 * result + (int) mRss;
result = 31 * result + Long.hashCode(mTimestamp);
result = 31 * result + Objects.hashCode(mProcessName);
result = 31 * result + Objects.hashCode(mDescription);
diff --git a/core/java/android/os/Trace.java b/core/java/android/os/Trace.java
index 25584f1..3508b70 100644
--- a/core/java/android/os/Trace.java
+++ b/core/java/android/os/Trace.java
@@ -101,6 +101,8 @@
public static final long TRACE_TAG_NNAPI = 1L << 25;
/** @hide */
public static final long TRACE_TAG_RRO = 1L << 26;
+ /** @hide */
+ public static final long TRACE_TAG_APEX_MANAGER = 1L << 18;
private static final long TRACE_TAG_NOT_READY = 1L << 63;
private static final int MAX_SECTION_NAME_LEN = 127;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a407bd8..a6f8fad 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -12729,12 +12729,14 @@
return findViewInsideOutShouldExist(root, mNextFocusForwardId);
case FOCUS_BACKWARD: {
if (mID == View.NO_ID) return null;
- return root.findViewByPredicateInsideOut(this, new Predicate<View>() {
- @Override
- public boolean test(View t) {
- return t.findViewById(t.mNextFocusForwardId) == View.this;
- }
- });
+ final View rootView = root;
+ final View startView = this;
+ // Since we have forward links but no backward links, we need to find the view that
+ // forward links to this view. We can't just find the view with the specified ID
+ // because view IDs need not be unique throughout the tree.
+ return root.findViewByPredicateInsideOut(startView,
+ t -> findViewInsideOutShouldExist(rootView, t, t.mNextFocusForwardId)
+ == startView);
}
}
return null;
@@ -12764,11 +12766,15 @@
}
private View findViewInsideOutShouldExist(View root, int id) {
+ return findViewInsideOutShouldExist(root, this, id);
+ }
+
+ private View findViewInsideOutShouldExist(View root, View start, int id) {
if (mMatchIdPredicate == null) {
mMatchIdPredicate = new MatchIdPredicate();
}
mMatchIdPredicate.mId = id;
- View result = root.findViewByPredicateInsideOut(this, mMatchIdPredicate);
+ View result = root.findViewByPredicateInsideOut(start, mMatchIdPredicate);
if (result == null) {
Log.w(VIEW_LOG_TAG, "couldn't find view with id " + id);
}
diff --git a/core/java/android/webkit/WebResourceRequest.java b/core/java/android/webkit/WebResourceRequest.java
index 964b6f8..0b307e6 100644
--- a/core/java/android/webkit/WebResourceRequest.java
+++ b/core/java/android/webkit/WebResourceRequest.java
@@ -32,10 +32,10 @@
Uri getUrl();
/**
- * Gets whether the request was made for the main frame.
+ * Gets whether the request was made in order to fetch the main frame's document.
*
- * @return whether the request was made for the main frame. Will be {@code false} for iframes,
- * for example.
+ * @return whether the request was made for the main frame document. Will be
+ * {@code false} for subresources or iframes, for example.
*/
boolean isForMainFrame();
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index bbb7513..a934de3 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -1487,7 +1487,6 @@
for (int i = 0; i < tabWidget.getChildCount(); i++) {
TextView title = tabWidget.getChildAt(i).findViewById(android.R.id.title);
title.setTextColor(getColor(R.color.resolver_tabs_inactive_color));
- title.setAllCaps(false);
}
}
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 26d2f19..2fcc1de 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -903,7 +903,6 @@
} break;
case "component-override": {
readComponentOverrides(parser, permFile);
- XmlUtils.skipCurrentTag(parser);
} break;
case "backup-transport-whitelisted-service": {
if (allowFeatures) {
@@ -1403,8 +1402,7 @@
final int depth = parser.getDepth();
while (XmlUtils.nextElementWithin(parser, depth)) {
- String name = parser.getName();
- if ("component".equals(name)) {
+ if ("component".equals(parser.getName())) {
String clsname = parser.getAttributeValue(null, "class");
String enabled = parser.getAttributeValue(null, "enabled");
if (clsname == null) {
@@ -1432,8 +1430,6 @@
}
componentEnabledStates.put(clsname, !"false".equals(enabled));
- } else {
- XmlUtils.skipCurrentTag(parser);
}
}
}
diff --git a/core/jni/android/graphics/FontFamily.cpp b/core/jni/android/graphics/FontFamily.cpp
index 8fc6afa..2a56fd6d 100644
--- a/core/jni/android/graphics/FontFamily.cpp
+++ b/core/jni/android/graphics/FontFamily.cpp
@@ -34,9 +34,9 @@
#include <hwui/MinikinSkia.h>
#include <hwui/Typeface.h>
-#include <utils/FatVector.h>
#include <minikin/FontFamily.h>
#include <minikin/LocaleList.h>
+#include <ui/FatVector.h>
#include <memory>
@@ -109,7 +109,7 @@
static bool addSkTypeface(NativeFamilyBuilder* builder, sk_sp<SkData>&& data, int ttcIndex,
jint weight, jint italic) {
- uirenderer::FatVector<SkFontArguments::Axis, 2> skiaAxes;
+ FatVector<SkFontArguments::Axis, 2> skiaAxes;
for (const auto& axis : builder->axes) {
skiaAxes.emplace_back(SkFontArguments::Axis{axis.axisTag, axis.value});
}
diff --git a/core/jni/android/graphics/fonts/Font.cpp b/core/jni/android/graphics/fonts/Font.cpp
index bb0654d..8d84e87 100644
--- a/core/jni/android/graphics/fonts/Font.cpp
+++ b/core/jni/android/graphics/fonts/Font.cpp
@@ -33,8 +33,8 @@
#include <hwui/MinikinSkia.h>
#include <hwui/Typeface.h>
-#include <utils/FatVector.h>
#include <minikin/FontFamily.h>
+#include <ui/FatVector.h>
#include <memory>
@@ -157,7 +157,7 @@
sk_sp<SkData> data(SkData::MakeWithProc(fontPtr, fontSize,
release_global_ref, reinterpret_cast<void*>(fontRef)));
- uirenderer::FatVector<SkFontArguments::Axis, 2> skiaAxes;
+ FatVector<SkFontArguments::Axis, 2> skiaAxes;
for (const auto& axis : builder->axes) {
skiaAxes.emplace_back(SkFontArguments::Axis{axis.axisTag, axis.value});
}
diff --git a/core/proto/android/app/appexitinfo.proto b/core/proto/android/app/appexitinfo.proto
index e23f150..6a49220 100644
--- a/core/proto/android/app/appexitinfo.proto
+++ b/core/proto/android/app/appexitinfo.proto
@@ -178,8 +178,8 @@
}
optional Importance importance = 10;
- optional int32 pss = 11;
- optional int32 rss = 12;
+ optional int64 pss = 11;
+ optional int64 rss = 12;
optional int64 timestamp = 13;
optional string description = 14;
}
diff --git a/core/proto/android/server/jobscheduler.proto b/core/proto/android/server/jobscheduler.proto
index 303d62d..546c5a0 100644
--- a/core/proto/android/server/jobscheduler.proto
+++ b/core/proto/android/server/jobscheduler.proto
@@ -219,12 +219,8 @@
// The maximum number of background jobs we allow when the system is in a
// critical memory state.
optional int32 bg_critical_job_count = 14;
- // The maximum number of times we allow a job to have itself rescheduled
- // before giving up on it, for standard jobs.
- optional int32 max_standard_reschedule_count = 15;
- // The maximum number of times we allow a job to have itself rescheduled
- // before giving up on it, for jobs that are executing work.
- optional int32 max_work_reschedule_count = 16;
+ reserved 15; // max_standard_reschedule_count
+ reserved 16; // max_work_reschedule_count
// The minimum backoff time to allow for linear backoff.
optional int64 min_linear_backoff_time_ms = 17;
// The minimum backoff time to allow for exponential backoff.
diff --git a/core/proto/android/service/OWNERS b/core/proto/android/service/OWNERS
new file mode 100644
index 0000000..70cb50f
--- /dev/null
+++ b/core/proto/android/service/OWNERS
@@ -0,0 +1 @@
+per-file sensor_service.proto = arthuri@google.com, bduddie@google.com, stange@google.com
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 6d63a53..ff69671 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1535,7 +1535,7 @@
@hide
-->
<permission android:name="android.permission.ACCESS_CONTEXT_HUB"
- android:protectionLevel="signature" />
+ android:protectionLevel="signature|privileged" />
<uses-permission android:name="android.permission.ACCESS_CONTEXT_HUB"/>
<!-- @SystemApi Allows an application to create mock location providers for testing.
diff --git a/core/res/res/drawable/tab_indicator_resolver.xml b/core/res/res/drawable/tab_indicator_resolver.xml
new file mode 100644
index 0000000..ff16d81a
--- /dev/null
+++ b/core/res/res/drawable/tab_indicator_resolver.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ android:paddingMode="nest">
+ <item>
+ <ripple android:color="@color/tab_highlight_material">
+ <item android:id="@id/mask">
+ <color android:color="@color/white" />
+ </item>
+ </ripple>
+ </item>
+ <item android:gravity="bottom">
+ <shape android:shape="rectangle"
+ android:tint="@color/resolver_tabs_active_color">
+ <size android:height="2dp" />
+ <solid android:color="@color/tab_indicator_material" />
+ </shape>
+ </item>
+ <item android:bottom="2dp"
+ android:drawable="@color/transparent" />
+</layer-list>
diff --git a/core/res/res/layout/tab_indicator_resolver.xml b/core/res/res/layout/tab_indicator_resolver.xml
new file mode 100644
index 0000000..2038da6
--- /dev/null
+++ b/core/res/res/layout/tab_indicator_resolver.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="?android:attr/actionBarSize"
+ android:orientation="horizontal"
+ style="@android:style/Widget.Material.Resolver.Tab">
+
+ <ImageView
+ android:id="@android:id/icon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:textAllCaps="false"
+ style="@android:style/Widget.Material.TabText" />
+
+</LinearLayout>
diff --git a/core/res/res/values-night/colors.xml b/core/res/res/values-night/colors.xml
index c5e72f0..33caeb6 100644
--- a/core/res/res/values-night/colors.xml
+++ b/core/res/res/values-night/colors.xml
@@ -32,4 +32,6 @@
<color name="chooser_row_divider">@color/list_divider_color_dark</color>
<color name="chooser_gradient_background">@color/loading_gradient_background_color_dark</color>
<color name="chooser_gradient_highlight">@color/loading_gradient_highlight_color_dark</color>
+
+ <color name="resolver_tabs_active_color">#FF8AB4F8</color>
</resources>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index cef21db..81ec278 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -1679,6 +1679,15 @@
<item name="listPreferredItemPaddingStart">?attr/dialogPreferredPadding</item>
<item name="listPreferredItemPaddingEnd">?attr/dialogPreferredPadding</item>
<item name="navigationBarColor">@android:color/transparent</item>
+ <item name="tabWidgetStyle">@style/Widget.DeviceDefault.Resolver.TabWidget</item>
+ </style>
+
+ <style name="Widget.DeviceDefault.Resolver.TabWidget" parent="Widget.DeviceDefault.TabWidget">
+ <item name="tabLayout">@layout/tab_indicator_resolver</item>
+ </style>
+
+ <style name="Widget.Material.Resolver.Tab" parent="Widget.Material.Tab">
+ <item name="background">@drawable/tab_indicator_resolver</item>
</style>
<style name="Theme.DeviceDefault.Resolver" parent="Theme.DeviceDefault.ResolverCommon">
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 6761435..31e4555 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -27,7 +27,6 @@
#include "DamageAccumulator.h"
#include "pipeline/skia/SkiaDisplayList.h"
#endif
-#include "utils/FatVector.h"
#include "utils/MathUtils.h"
#include "utils/StringUtils.h"
#include "utils/TraceUtils.h"
@@ -37,6 +36,7 @@
#include <atomic>
#include <sstream>
#include <string>
+#include <ui/FatVector.h>
namespace android {
namespace uirenderer {
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index d55e5b0..c0ec217 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -27,6 +27,8 @@
#include <androidfw/ResourceTypes.h>
+#include <ui/FatVector.h>
+
#include "AnimatorManager.h"
#include "CanvasTransform.h"
#include "Debug.h"
@@ -35,7 +37,6 @@
#include "RenderProperties.h"
#include "pipeline/skia/SkiaDisplayList.h"
#include "pipeline/skia/SkiaLayer.h"
-#include "utils/FatVector.h"
#include <vector>
diff --git a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.h b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.h
index cfc0f9b..d669f84 100644
--- a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.h
+++ b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.h
@@ -21,7 +21,7 @@
#include <SkCanvas.h>
#include <SkDrawable.h>
-#include <utils/FatVector.h>
+#include <ui/FatVector.h>
namespace android {
namespace uirenderer {
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index cae3e3b..206b58f 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -27,7 +27,6 @@
#include "pipeline/skia/SkiaOpenGLPipeline.h"
#include "pipeline/skia/SkiaVulkanPipeline.h"
#include "renderstate/RenderState.h"
-#include "utils/FatVector.h"
#include "utils/TimeUtils.h"
#include "utils/TraceUtils.h"
@@ -40,6 +39,8 @@
#include <utils/Mutex.h>
#include <thread>
+#include <ui/FatVector.h>
+
namespace android {
namespace uirenderer {
namespace renderthread {
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index a5355fc..ba70afc 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -23,13 +23,13 @@
#include <GrContext.h>
#include <GrTypes.h>
#include <android/sync.h>
+#include <ui/FatVector.h>
#include <vk/GrVkExtensions.h>
#include <vk/GrVkTypes.h>
#include "Properties.h"
#include "RenderThread.h"
#include "renderstate/RenderState.h"
-#include "utils/FatVector.h"
#include "utils/TraceUtils.h"
namespace android {
diff --git a/libs/hwui/tests/unit/FatVectorTests.cpp b/libs/hwui/tests/unit/FatVectorTests.cpp
index 8523e6c..6585a62 100644
--- a/libs/hwui/tests/unit/FatVectorTests.cpp
+++ b/libs/hwui/tests/unit/FatVectorTests.cpp
@@ -15,7 +15,7 @@
*/
#include <gtest/gtest.h>
-#include <utils/FatVector.h>
+#include <ui/FatVector.h>
#include <tests/common/TestUtils.h>
diff --git a/libs/hwui/utils/FatVector.h b/libs/hwui/utils/FatVector.h
deleted file mode 100644
index 8cc4d10..0000000
--- a/libs/hwui/utils/FatVector.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2015, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ANDROID_FAT_VECTOR_H
-#define ANDROID_FAT_VECTOR_H
-
-#include "utils/Macros.h"
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <utils/Log.h>
-#include <type_traits>
-
-#include <vector>
-
-namespace android {
-namespace uirenderer {
-
-template <typename T, size_t SIZE>
-class InlineStdAllocator {
-public:
- struct Allocation {
- PREVENT_COPY_AND_ASSIGN(Allocation);
-
- public:
- Allocation(){};
- // char array instead of T array, so memory is uninitialized, with no destructors run
- char array[sizeof(T) * SIZE];
- bool inUse = false;
- };
-
- typedef T value_type; // needed to implement std::allocator
- typedef T* pointer; // needed to implement std::allocator
-
- explicit InlineStdAllocator(Allocation& allocation) : mAllocation(allocation) {}
- InlineStdAllocator(const InlineStdAllocator& other) : mAllocation(other.mAllocation) {}
- ~InlineStdAllocator() {}
-
- T* allocate(size_t num, const void* = 0) {
- if (!mAllocation.inUse && num <= SIZE) {
- mAllocation.inUse = true;
- return (T*)mAllocation.array;
- } else {
- return (T*)malloc(num * sizeof(T));
- }
- }
-
- void deallocate(pointer p, size_t num) {
- if (p == (T*)mAllocation.array) {
- mAllocation.inUse = false;
- } else {
- // 'free' instead of delete here - destruction handled separately
- free(p);
- }
- }
- Allocation& mAllocation;
-};
-
-/**
- * std::vector with SIZE elements preallocated into an internal buffer.
- *
- * Useful for avoiding the cost of malloc in cases where only SIZE or
- * fewer elements are needed in the common case.
- */
-template <typename T, size_t SIZE>
-class FatVector : public std::vector<T, InlineStdAllocator<T, SIZE>> {
-public:
- FatVector()
- : std::vector<T, InlineStdAllocator<T, SIZE>>(
- InlineStdAllocator<T, SIZE>(mAllocation)) {
- this->reserve(SIZE);
- }
-
- explicit FatVector(size_t capacity) : FatVector() { this->resize(capacity); }
-
-private:
- typename InlineStdAllocator<T, SIZE>::Allocation mAllocation;
-};
-
-} // namespace uirenderer
-} // namespace android
-
-#endif // ANDROID_FAT_VECTOR_H
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 14eec59..9da99c4 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -151,7 +151,7 @@
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000;
- private static final boolean DEBUG = KeyguardConstants.DEBUG;
+ private static final boolean DEBUG = true;
private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
private final static String TAG = "KeyguardViewMediator";
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index f071135..46dc21bb 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -9256,7 +9256,7 @@
}
BackgroundThread.getHandler().post(() -> {
- if (hasCompanionDevice(serviceInfo)) {
+ if (serviceInfo.isSystem || hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelChanged(
serviceInfo, pkg, user, channel, modificationType);
}
@@ -9276,7 +9276,7 @@
}
BackgroundThread.getHandler().post(() -> {
- if (hasCompanionDevice(serviceInfo)) {
+ if (serviceInfo.isSystem || hasCompanionDevice(serviceInfo)) {
notifyNotificationChannelGroupChanged(
serviceInfo, pkg, user, group, modificationType);
}
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index 42bc464..a440c62 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -36,6 +36,7 @@
import android.os.Environment;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.Trace;
import android.sysprop.ApexProperties;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -46,6 +47,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
+import com.android.server.utils.TimingsTraceAndSlog;
import com.google.android.collect.Lists;
@@ -375,8 +377,11 @@
@Override
public List<ActiveApexInfo> getActiveApexInfos() {
+ final TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG + "Timing",
+ Trace.TRACE_TAG_APEX_MANAGER);
synchronized (mLock) {
if (mActiveApexInfosCache == null) {
+ t.traceBegin("getActiveApexInfos_noCache");
try {
mActiveApexInfosCache = new ArraySet<>();
final ApexInfo[] activePackages = mApexService.getActivePackages();
@@ -387,6 +392,7 @@
} catch (RemoteException e) {
Slog.e(TAG, "Unable to retrieve packages from apexservice", e);
}
+ t.traceEnd();
}
if (mActiveApexInfosCache != null) {
return new ArrayList<>(mActiveApexInfosCache);
diff --git a/services/people/java/com/android/server/people/data/ConversationInfo.java b/services/people/java/com/android/server/people/data/ConversationInfo.java
index bb97533..b60ed3e 100644
--- a/services/people/java/com/android/server/people/data/ConversationInfo.java
+++ b/services/people/java/com/android/server/people/data/ConversationInfo.java
@@ -35,7 +35,7 @@
*/
public class ConversationInfo {
- private static final int FLAG_VIP = 1;
+ private static final int FLAG_IMPORTANT = 1;
private static final int FLAG_NOTIFICATION_SILENCED = 1 << 1;
@@ -50,7 +50,7 @@
private static final int FLAG_DEMOTED = 1 << 6;
@IntDef(flag = true, prefix = {"FLAG_"}, value = {
- FLAG_VIP,
+ FLAG_IMPORTANT,
FLAG_NOTIFICATION_SILENCED,
FLAG_BUBBLED,
FLAG_PERSON_IMPORTANT,
@@ -129,9 +129,9 @@
return hasShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED);
}
- /** Whether this conversation is marked as VIP by the user. */
- public boolean isVip() {
- return hasConversationFlags(FLAG_VIP);
+ /** Whether this conversation is marked as important by the user. */
+ public boolean isImportant() {
+ return hasConversationFlags(FLAG_IMPORTANT);
}
/** Whether the notifications for this conversation should be silenced. */
@@ -208,8 +208,8 @@
sb.append("]");
sb.append(", conversationFlags=0x").append(Integer.toHexString(mConversationFlags));
sb.append(" [");
- if (isVip()) {
- sb.append("Vip");
+ if (isImportant()) {
+ sb.append("Imp");
}
if (isNotificationSilenced()) {
sb.append("Sil");
@@ -221,7 +221,7 @@
sb.append("Dem");
}
if (isPersonImportant()) {
- sb.append("Imp");
+ sb.append("PIm");
}
if (isPersonBot()) {
sb.append("Bot");
@@ -318,8 +318,8 @@
return this;
}
- Builder setVip(boolean value) {
- return setConversationFlag(FLAG_VIP, value);
+ Builder setImportant(boolean value) {
+ return setConversationFlag(FLAG_IMPORTANT, value);
}
Builder setNotificationSilenced(boolean value) {
diff --git a/services/people/java/com/android/server/people/data/DataManager.java b/services/people/java/com/android/server/people/data/DataManager.java
index 7fdcf42..7a3ed53 100644
--- a/services/people/java/com/android/server/people/data/DataManager.java
+++ b/services/people/java/com/android/server/people/data/DataManager.java
@@ -21,6 +21,8 @@
import android.annotation.UserIdInt;
import android.annotation.WorkerThread;
import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
import android.app.Person;
import android.app.prediction.AppTarget;
import android.app.prediction.AppTargetEvent;
@@ -157,8 +159,8 @@
mNotificationListeners.put(userId, notificationListener);
try {
notificationListener.registerAsSystemService(mContext,
- new ComponentName(PLATFORM_PACKAGE_NAME, getClass().getSimpleName()),
- UserHandle.myUserId());
+ new ComponentName(PLATFORM_PACKAGE_NAME, getClass().getCanonicalName()),
+ userId);
} catch (RemoteException e) {
// Should never occur for local calls.
}
@@ -571,6 +573,44 @@
long currentTime = System.currentTimeMillis();
eventHistory.addEvent(new Event(currentTime, Event.TYPE_NOTIFICATION_OPENED));
}
+
+ @Override
+ public void onNotificationChannelModified(String pkg, UserHandle user,
+ NotificationChannel channel, int modificationType) {
+ PackageData packageData = getPackage(pkg, user.getIdentifier());
+ String shortcutId = channel.getConversationId();
+ if (packageData == null || shortcutId == null) {
+ return;
+ }
+ ConversationStore conversationStore = packageData.getConversationStore();
+ ConversationInfo conversationInfo = conversationStore.getConversation(shortcutId);
+ if (conversationInfo == null) {
+ return;
+ }
+ ConversationInfo.Builder builder = new ConversationInfo.Builder(conversationInfo);
+ switch (modificationType) {
+ case NOTIFICATION_CHANNEL_OR_GROUP_ADDED:
+ case NOTIFICATION_CHANNEL_OR_GROUP_UPDATED:
+ builder.setNotificationChannelId(channel.getId());
+ builder.setImportant(channel.isImportantConversation());
+ builder.setDemoted(channel.isDemoted());
+ builder.setNotificationSilenced(
+ channel.getImportance() <= NotificationManager.IMPORTANCE_LOW);
+ builder.setBubbled(channel.canBubble());
+ break;
+ case NOTIFICATION_CHANNEL_OR_GROUP_DELETED:
+ // If the notification channel is deleted, revert all the notification settings
+ // to the default value.
+ builder.setNotificationChannelId(null);
+ builder.setImportant(false);
+ builder.setDemoted(false);
+ builder.setNotificationSilenced(false);
+ builder.setBubbled(false);
+ break;
+ }
+ conversationStore.addOrUpdate(builder.build());
+ // TODO: Cache the shortcut when a conversation's notification setting is changed.
+ }
}
/**
diff --git a/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java b/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java
index 8d2a152..6083ce34 100644
--- a/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/am/ApplicationExitInfoTest.java
@@ -174,12 +174,12 @@
final int app1ConnectiongGroup = 10;
final int app1UidUser2 = 1010123;
final int app1PidUser2 = 12347;
- final int app1Pss1 = 34567;
- final int app1Rss1 = 45678;
- final int app1Pss2 = 34568;
- final int app1Rss2 = 45679;
- final int app1Pss3 = 34569;
- final int app1Rss3 = 45680;
+ final long app1Pss1 = 34567;
+ final long app1Rss1 = 45678;
+ final long app1Pss2 = 34568;
+ final long app1Rss2 = 45679;
+ final long app1Pss3 = 34569;
+ final long app1Rss3 = 45680;
final String app1ProcessName = "com.android.test.stub1:process";
final String app1PackageName = "com.android.test.stub1";
@@ -344,8 +344,8 @@
// Case 4: Create a process from another package with kill from lmkd
final int app2UidUser2 = 1010234;
final int app2PidUser2 = 12348;
- final int app2Pss1 = 54321;
- final int app2Rss1 = 65432;
+ final long app2Pss1 = 54321;
+ final long app2Rss1 = 65432;
final String app2ProcessName = "com.android.test.stub2:process";
final String app2PackageName = "com.android.test.stub2";
@@ -402,8 +402,8 @@
final int app3UidUser2 = 1010345;
final int app3PidUser2 = 12349;
final int app3ConnectiongGroup = 4;
- final int app3Pss1 = 54320;
- final int app3Rss1 = 65430;
+ final long app3Pss1 = 54320;
+ final long app3Rss1 = 65430;
final String app3ProcessName = "com.android.test.stub3:process";
final String app3PackageName = "com.android.test.stub3";
final String app3Description = "native crash";
@@ -529,8 +529,8 @@
final int app3Uid = 10345;
final int app3IsolatedUid = 99001; // it's an isolated process
final int app3Pid = 12350;
- final int app3Pss2 = 23232;
- final int app3Rss2 = 32323;
+ final long app3Pss2 = 23232;
+ final long app3Rss2 = 32323;
final String app3Description2 = "force close";
sleep(1);
@@ -618,8 +618,8 @@
sleep(1);
final int app1IsolatedUidUser2 = 1099002; // isolated uid
- final int app1Pss4 = 34343;
- final int app1Rss4 = 43434;
+ final long app1Pss4 = 34343;
+ final long app1Rss4 = 43434;
final long now8 = System.currentTimeMillis();
sigNum = OsConstants.SIGKILL;
doReturn(new Pair<Long, Object>(now8, makeSignalStatus(sigNum)))
@@ -673,8 +673,8 @@
sleep(1);
final int app1Pid2User2 = 56565;
final int app1IsolatedUid2User2 = 1099003; // isolated uid
- final int app1Pss5 = 34344;
- final int app1Rss5 = 43435;
+ final long app1Pss5 = 34344;
+ final long app1Rss5 = 43435;
final long now9 = System.currentTimeMillis();
sigNum = OsConstants.SIGKILL;
doReturn(new Pair<Long, Object>(now9, makeSignalStatus(sigNum)))
@@ -831,7 +831,7 @@
}
private ProcessRecord makeProcessRecord(int pid, int uid, int packageUid, Integer definingUid,
- int connectionGroup, int procState, int pss, int rss,
+ int connectionGroup, int procState, long pss, long rss,
String processName, String packageName) {
ApplicationInfo ai = new ApplicationInfo();
ai.packageName = packageName;
@@ -847,8 +847,8 @@
app.connectionGroup = connectionGroup;
app.setProcState = procState;
app.lastMemInfo = spy(new Debug.MemoryInfo());
- doReturn(pss).when(app.lastMemInfo).getTotalPss();
- doReturn(rss).when(app.lastMemInfo).getTotalRss();
+ doReturn((int) pss).when(app.lastMemInfo).getTotalPss();
+ doReturn((int) rss).when(app.lastMemInfo).getTotalRss();
return app;
}
@@ -856,7 +856,7 @@
Long timestamp, Integer pid, Integer uid, Integer packageUid,
Integer definingUid, String processName, Integer connectionGroup,
Integer reason, Integer subReason, Integer status,
- Integer pss, Integer rss, Integer importance, String description) {
+ Long pss, Long rss, Integer importance, String description) {
assertNotNull(info);
if (timestamp != null) {
@@ -892,10 +892,10 @@
assertEquals(status.intValue(), info.getStatus());
}
if (pss != null) {
- assertEquals(pss.intValue(), info.getPss());
+ assertEquals(pss.longValue(), info.getPss());
}
if (rss != null) {
- assertEquals(rss.intValue(), info.getRss());
+ assertEquals(rss.longValue(), info.getRss());
}
if (importance != null) {
assertEquals(importance.intValue(), info.getImportance());
diff --git a/services/tests/mockingservicestests/src/com/android/server/blob/BlobStoreManagerServiceTest.java b/services/tests/mockingservicestests/src/com/android/server/blob/BlobStoreManagerServiceTest.java
index 16dde42..1f14740 100644
--- a/services/tests/mockingservicestests/src/com/android/server/blob/BlobStoreManagerServiceTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/blob/BlobStoreManagerServiceTest.java
@@ -43,6 +43,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -209,6 +210,7 @@
verify(file3, never()).delete();
}
+ @Ignore
@Test
public void testHandleIdleMaintenance_deleteStaleSessions() throws Exception {
// Setup sessions
@@ -216,8 +218,8 @@
doReturn(System.currentTimeMillis() - SESSION_EXPIRY_TIMEOUT_MILLIS + 1000)
.when(sessionFile1).lastModified();
final long sessionId1 = 342;
- final BlobHandle blobHandle1 = mock(BlobHandle.class);
- doReturn(System.currentTimeMillis() - 1000).when(blobHandle1).getExpiryTimeMillis();
+ final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest1".getBytes(),
+ "label1", System.currentTimeMillis() - 1000, "tag1");
final BlobStoreSession session1 = createBlobStoreSessionMock(TEST_PKG1, TEST_UID1,
sessionId1, sessionFile1, blobHandle1);
mUserSessions.append(sessionId1, session1);
@@ -226,8 +228,8 @@
doReturn(System.currentTimeMillis() - 20000)
.when(sessionFile2).lastModified();
final long sessionId2 = 4597;
- final BlobHandle blobHandle2 = mock(BlobHandle.class);
- doReturn(System.currentTimeMillis() + 20000).when(blobHandle2).getExpiryTimeMillis();
+ final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest2".getBytes(),
+ "label2", System.currentTimeMillis() + 20000, "tag2");
final BlobStoreSession session2 = createBlobStoreSessionMock(TEST_PKG2, TEST_UID2,
sessionId2, sessionFile2, blobHandle2);
mUserSessions.append(sessionId2, session2);
@@ -236,8 +238,8 @@
doReturn(System.currentTimeMillis() - SESSION_EXPIRY_TIMEOUT_MILLIS - 2000)
.when(sessionFile3).lastModified();
final long sessionId3 = 9484;
- final BlobHandle blobHandle3 = mock(BlobHandle.class);
- doReturn(System.currentTimeMillis() + 30000).when(blobHandle3).getExpiryTimeMillis();
+ final BlobHandle blobHandle3 = BlobHandle.createWithSha256("digest3".getBytes(),
+ "label3", System.currentTimeMillis() + 30000, "tag3");
final BlobStoreSession session3 = createBlobStoreSessionMock(TEST_PKG3, TEST_UID3,
sessionId3, sessionFile3, blobHandle3);
mUserSessions.append(sessionId3, session3);
diff --git a/services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java b/services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java
index 05a9a80..c0e7927 100644
--- a/services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/data/ConversationInfoTest.java
@@ -47,7 +47,7 @@
.setContactPhoneNumber(PHONE_NUMBER)
.setNotificationChannelId(NOTIFICATION_CHANNEL_ID)
.setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED)
- .setVip(true)
+ .setImportant(true)
.setNotificationSilenced(true)
.setBubbled(true)
.setDemoted(true)
@@ -62,7 +62,7 @@
assertEquals(PHONE_NUMBER, conversationInfo.getContactPhoneNumber());
assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId());
assertTrue(conversationInfo.isShortcutLongLived());
- assertTrue(conversationInfo.isVip());
+ assertTrue(conversationInfo.isImportant());
assertTrue(conversationInfo.isNotificationSilenced());
assertTrue(conversationInfo.isBubbled());
assertTrue(conversationInfo.isDemoted());
@@ -83,7 +83,7 @@
assertNull(conversationInfo.getContactPhoneNumber());
assertNull(conversationInfo.getNotificationChannelId());
assertFalse(conversationInfo.isShortcutLongLived());
- assertFalse(conversationInfo.isVip());
+ assertFalse(conversationInfo.isImportant());
assertFalse(conversationInfo.isNotificationSilenced());
assertFalse(conversationInfo.isBubbled());
assertFalse(conversationInfo.isDemoted());
@@ -101,7 +101,7 @@
.setContactPhoneNumber(PHONE_NUMBER)
.setNotificationChannelId(NOTIFICATION_CHANNEL_ID)
.setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED)
- .setVip(true)
+ .setImportant(true)
.setNotificationSilenced(true)
.setBubbled(true)
.setPersonImportant(true)
@@ -110,7 +110,7 @@
.build();
ConversationInfo destination = new ConversationInfo.Builder(source)
- .setVip(false)
+ .setImportant(false)
.setContactStarred(false)
.build();
@@ -120,7 +120,7 @@
assertEquals(PHONE_NUMBER, destination.getContactPhoneNumber());
assertEquals(NOTIFICATION_CHANNEL_ID, destination.getNotificationChannelId());
assertTrue(destination.isShortcutLongLived());
- assertFalse(destination.isVip());
+ assertFalse(destination.isImportant());
assertTrue(destination.isNotificationSilenced());
assertTrue(destination.isBubbled());
assertTrue(destination.isPersonImportant());
diff --git a/services/tests/servicestests/src/com/android/server/people/data/ConversationStoreTest.java b/services/tests/servicestests/src/com/android/server/people/data/ConversationStoreTest.java
index bbcb54e..331ad59 100644
--- a/services/tests/servicestests/src/com/android/server/people/data/ConversationStoreTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/data/ConversationStoreTest.java
@@ -167,7 +167,7 @@
.setContactPhoneNumber(phoneNumber)
.setNotificationChannelId(notificationChannelId)
.setShortcutFlags(ShortcutInfo.FLAG_LONG_LIVED)
- .setVip(true)
+ .setImportant(true)
.setBubbled(true)
.build();
}
diff --git a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
index ad5c57d..498d888 100644
--- a/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/people/data/DataManagerTest.java
@@ -16,10 +16,15 @@
package com.android.server.people.data;
+import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_ADDED;
+import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_DELETED;
+import static android.service.notification.NotificationListenerService.NOTIFICATION_CHANNEL_OR_GROUP_UPDATED;
+
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -33,6 +38,8 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
import android.app.Person;
import android.app.prediction.AppTarget;
import android.app.prediction.AppTargetEvent;
@@ -88,6 +95,7 @@
private static final String TEST_SHORTCUT_ID = "sc";
private static final String CONTACT_URI = "content://com.android.contacts/contacts/lookup/123";
private static final String PHONE_NUMBER = "+1234567890";
+ private static final String NOTIFICATION_CHANNEL_ID = "test : sc";
private static final long MILLIS_PER_MINUTE = 1000L * 60L;
@Mock private Context mContext;
@@ -103,6 +111,7 @@
@Mock private StatusBarNotification mStatusBarNotification;
@Mock private Notification mNotification;
+ private NotificationChannel mNotificationChannel;
private DataManager mDataManager;
private int mCallingUserId;
private TestInjector mInjector;
@@ -152,6 +161,10 @@
when(mStatusBarNotification.getUser()).thenReturn(UserHandle.of(USER_ID_PRIMARY));
when(mNotification.getShortcutId()).thenReturn(TEST_SHORTCUT_ID);
+ mNotificationChannel = new NotificationChannel(
+ NOTIFICATION_CHANNEL_ID, "test channel", NotificationManager.IMPORTANCE_DEFAULT);
+ mNotificationChannel.setConversationId("test", TEST_SHORTCUT_ID);
+
mCallingUserId = USER_ID_PRIMARY;
mInjector = new TestInjector();
@@ -284,9 +297,8 @@
}
@Test
- public void testNotificationListener() {
+ public void testNotificationOpened() {
mDataManager.onUserUnlocked(USER_ID_PRIMARY);
- mDataManager.onUserUnlocked(USER_ID_SECONDARY);
ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
buildPerson());
@@ -308,6 +320,83 @@
}
@Test
+ public void testNotificationChannelCreated() {
+ mDataManager.onUserUnlocked(USER_ID_PRIMARY);
+ mDataManager.onUserUnlocked(USER_ID_SECONDARY);
+
+ ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
+ buildPerson());
+ mDataManager.onShortcutAddedOrUpdated(shortcut);
+
+ NotificationListenerService listenerService =
+ mDataManager.getNotificationListenerServiceForTesting(USER_ID_PRIMARY);
+ listenerService.onNotificationChannelModified(TEST_PKG_NAME, UserHandle.of(USER_ID_PRIMARY),
+ mNotificationChannel, NOTIFICATION_CHANNEL_OR_GROUP_ADDED);
+
+ ConversationInfo conversationInfo = mDataManager.getPackage(TEST_PKG_NAME, USER_ID_PRIMARY)
+ .getConversationStore()
+ .getConversation(TEST_SHORTCUT_ID);
+ assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId());
+ assertFalse(conversationInfo.isImportant());
+ assertFalse(conversationInfo.isNotificationSilenced());
+ assertFalse(conversationInfo.isDemoted());
+ }
+
+ @Test
+ public void testNotificationChannelModified() {
+ mNotificationChannel.setImportantConversation(true);
+
+ mDataManager.onUserUnlocked(USER_ID_PRIMARY);
+ mDataManager.onUserUnlocked(USER_ID_SECONDARY);
+
+ ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
+ buildPerson());
+ mDataManager.onShortcutAddedOrUpdated(shortcut);
+
+ NotificationListenerService listenerService =
+ mDataManager.getNotificationListenerServiceForTesting(USER_ID_PRIMARY);
+ listenerService.onNotificationChannelModified(TEST_PKG_NAME, UserHandle.of(USER_ID_PRIMARY),
+ mNotificationChannel, NOTIFICATION_CHANNEL_OR_GROUP_UPDATED);
+
+ ConversationInfo conversationInfo = mDataManager.getPackage(TEST_PKG_NAME, USER_ID_PRIMARY)
+ .getConversationStore()
+ .getConversation(TEST_SHORTCUT_ID);
+ assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId());
+ assertTrue(conversationInfo.isImportant());
+ assertFalse(conversationInfo.isNotificationSilenced());
+ assertFalse(conversationInfo.isDemoted());
+ }
+
+ @Test
+ public void testNotificationChannelDeleted() {
+ mDataManager.onUserUnlocked(USER_ID_PRIMARY);
+ mDataManager.onUserUnlocked(USER_ID_SECONDARY);
+
+ ShortcutInfo shortcut = buildShortcutInfo(TEST_PKG_NAME, USER_ID_PRIMARY, TEST_SHORTCUT_ID,
+ buildPerson());
+ mDataManager.onShortcutAddedOrUpdated(shortcut);
+
+ NotificationListenerService listenerService =
+ mDataManager.getNotificationListenerServiceForTesting(USER_ID_PRIMARY);
+ listenerService.onNotificationChannelModified(TEST_PKG_NAME, UserHandle.of(USER_ID_PRIMARY),
+ mNotificationChannel, NOTIFICATION_CHANNEL_OR_GROUP_ADDED);
+ ConversationInfo conversationInfo = mDataManager.getPackage(TEST_PKG_NAME, USER_ID_PRIMARY)
+ .getConversationStore()
+ .getConversation(TEST_SHORTCUT_ID);
+ assertEquals(NOTIFICATION_CHANNEL_ID, conversationInfo.getNotificationChannelId());
+
+ listenerService.onNotificationChannelModified(TEST_PKG_NAME, UserHandle.of(USER_ID_PRIMARY),
+ mNotificationChannel, NOTIFICATION_CHANNEL_OR_GROUP_DELETED);
+ conversationInfo = mDataManager.getPackage(TEST_PKG_NAME, USER_ID_PRIMARY)
+ .getConversationStore()
+ .getConversation(TEST_SHORTCUT_ID);
+ assertNull(conversationInfo.getNotificationChannelId());
+ assertFalse(conversationInfo.isImportant());
+ assertFalse(conversationInfo.isNotificationSilenced());
+ assertFalse(conversationInfo.isDemoted());
+ }
+
+ @Test
public void testCallLogContentObserver() {
mDataManager.onUserUnlocked(USER_ID_PRIMARY);
mDataManager.onUserUnlocked(USER_ID_SECONDARY);
diff --git a/services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigTest.java b/services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigTest.java
index fde0ddf..4d0481be 100644
--- a/services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigTest.java
+++ b/services/tests/servicestests/src/com/android/server/systemconfig/SystemConfigTest.java
@@ -144,6 +144,40 @@
assertEquals("Incorrect blacklist", expectedBlack, actualBlack);
}
+ @Test
+ public void testComponentOverride() throws Exception {
+ final String contents =
+ "<permissions>"
+ + " <component-override package=\"com.android.package1\">\n"
+ + " <component class=\"com.android.package1.Full\" enabled=\"true\"/>"
+ + " <component class=\".Relative\" enabled=\"false\" />\n"
+ + " </component-override>"
+ + " <component-override package=\"com.android.package2\" >\n"
+ + " <component class=\"com.android.package3.Relative2\" enabled=\"yes\" />\n"
+ + " </component-override>\n"
+ + "</permissions>";
+
+ final File folder = createTempSubfolder("folder");
+ createTempFile(folder, "component-override.xml", contents);
+
+ mSysConfig.readPermissions(folder, /* No permission needed anyway */ 0);
+
+ final ArrayMap<String, Boolean> packageOneExpected = new ArrayMap<>();
+ packageOneExpected.put("com.android.package1.Full", true);
+ packageOneExpected.put("com.android.package1.Relative", false);
+
+ final ArrayMap<String, Boolean> packageTwoExpected = new ArrayMap<>();
+ packageTwoExpected.put("com.android.package3.Relative2", true);
+
+ final Map<String, Boolean> packageOne = mSysConfig.getComponentsEnabledStates(
+ "com.android.package1");
+ assertEquals(packageOneExpected, packageOne);
+
+ final Map<String, Boolean> packageTwo = mSysConfig.getComponentsEnabledStates(
+ "com.android.package2");
+ assertEquals(packageTwoExpected, packageTwo);
+ }
+
/**
* Creates folderName/fileName in the mTemporaryFolder and fills it with the contents.
* @param folderName subdirectory of mTemporaryFolder to put the file, creating if needed
diff --git a/tests/RollbackTest/Android.bp b/tests/RollbackTest/Android.bp
index 98e7b4e..89005da 100644
--- a/tests/RollbackTest/Android.bp
+++ b/tests/RollbackTest/Android.bp
@@ -36,6 +36,15 @@
}
java_test_host {
+ name: "NetworkStagedRollbackTest",
+ srcs: ["NetworkStagedRollbackTest/src/**/*.java"],
+ libs: ["tradefed"],
+ static_libs: ["testng"],
+ test_suites: ["general-tests"],
+ test_config: "NetworkStagedRollbackTest.xml",
+}
+
+java_test_host {
name: "MultiUserRollbackTest",
srcs: ["MultiUserRollbackTest/src/**/*.java"],
libs: ["tradefed"],
diff --git a/tests/RollbackTest/NetworkStagedRollbackTest.xml b/tests/RollbackTest/NetworkStagedRollbackTest.xml
new file mode 100644
index 0000000..a465a4f
--- /dev/null
+++ b/tests/RollbackTest/NetworkStagedRollbackTest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Runs the network staged rollback tests">
+ <option name="test-suite-tag" value="NetworkStagedRollbackTest" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="RollbackTest.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.HostTest" >
+ <option name="class" value="com.android.tests.rollback.host.NetworkStagedRollbackTest" />
+ </test>
+</configuration>
diff --git a/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java b/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java
new file mode 100644
index 0000000..2c2e8282
--- /dev/null
+++ b/tests/RollbackTest/NetworkStagedRollbackTest/src/com/android/tests/rollback/host/NetworkStagedRollbackTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tests.rollback.host;
+
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Runs the network rollback tests.
+ */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class NetworkStagedRollbackTest extends BaseHostJUnit4Test {
+ /**
+ * Tests failed network health check triggers watchdog staged rollbacks.
+ */
+ @Test
+ public void testNetworkFailedRollback() throws Exception {
+ }
+
+ /**
+ * Tests passed network health check does not trigger watchdog staged rollbacks.
+ */
+ @Test
+ public void testNetworkPassedDoesNotRollback() throws Exception {
+ }
+}
diff --git a/tests/RollbackTest/RollbackTest.xml b/tests/RollbackTest/RollbackTest.xml
index a14b01c..f2c0f86 100644
--- a/tests/RollbackTest/RollbackTest.xml
+++ b/tests/RollbackTest/RollbackTest.xml
@@ -22,9 +22,9 @@
<option name="package" value="com.android.tests.rollback" />
<option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
- <!-- Exclude the StagedRollbackTest and MultiUserRollbackTest tests, which need to be
- specially driven from the StagedRollbackTest and MultiUserRollbackTest host test -->
+ <!-- Exclude the device tests which need to be specially driven from the host tests -->
<option name="exclude-filter" value="com.android.tests.rollback.StagedRollbackTest" />
+ <option name="exclude-filter" value="com.android.tests.rollback.NetworkStagedRollbackTest" />
<option name="exclude-filter" value="com.android.tests.rollback.MultiUserRollbackTest" />
</test>
</configuration>
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/NetworkStagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/NetworkStagedRollbackTest.java
new file mode 100644
index 0000000..04004d6
--- /dev/null
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/NetworkStagedRollbackTest.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tests.rollback;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class NetworkStagedRollbackTest {
+}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 1682023..5ccc3aa 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2982,7 +2982,7 @@
}
/**
- * Start Soft AP (hotspot) mode with the specified configuration.
+ * Start Soft AP (hotspot) mode for tethering purposes with the specified configuration.
* Note that starting Soft AP mode may disable station mode operation if the device does not
* support concurrency.
* @param wifiConfig SSID, security and channel details as part of WifiConfiguration, or null to
@@ -3278,7 +3278,7 @@
}
/**
- * Gets the Wi-Fi enabled state.
+ * Gets the tethered Wi-Fi hotspot enabled state.
* @return One of {@link #WIFI_AP_STATE_DISABLED},
* {@link #WIFI_AP_STATE_DISABLING}, {@link #WIFI_AP_STATE_ENABLED},
* {@link #WIFI_AP_STATE_ENABLING}, {@link #WIFI_AP_STATE_FAILED}
@@ -3297,8 +3297,8 @@
}
/**
- * Return whether Wi-Fi AP is enabled or disabled.
- * @return {@code true} if Wi-Fi AP is enabled
+ * Return whether tethered Wi-Fi AP is enabled or disabled.
+ * @return {@code true} if tethered Wi-Fi AP is enabled
* @see #getWifiApState()
*
* @hide
@@ -3310,7 +3310,7 @@
}
/**
- * Gets the Wi-Fi AP Configuration.
+ * Gets the tethered Wi-Fi AP Configuration.
* @return AP details in WifiConfiguration
*
* Note that AP detail may contain configuration which is cannot be represented
@@ -3332,7 +3332,7 @@
}
/**
- * Gets the Wi-Fi AP Configuration.
+ * Gets the Wi-Fi tethered AP Configuration.
* @return AP details in {@link SoftApConfiguration}
*
* @hide
@@ -3349,7 +3349,7 @@
}
/**
- * Sets the Wi-Fi AP Configuration.
+ * Sets the tethered Wi-Fi AP Configuration.
* @return {@code true} if the operation succeeded, {@code false} otherwise
*
* @deprecated This API is deprecated. Use {@link #setSoftApConfiguration(SoftApConfiguration)}
@@ -3368,9 +3368,9 @@
}
/**
- * Sets the Wi-Fi AP Configuration.
+ * Sets the tethered Wi-Fi AP Configuration.
*
- * If the API is called while the soft AP is enabled, the configuration will apply to
+ * If the API is called while the tethered soft AP is enabled, the configuration will apply to
* the current soft AP if the new configuration only includes
* {@link SoftApConfiguration.Builder#setMaxNumberOfClients(int)}
* or {@link SoftApConfiguration.Builder#setShutdownTimeoutMillis(int)}