summaryrefslogtreecommitdiff
path: root/apex
diff options
context:
space:
mode:
Diffstat (limited to 'apex')
-rw-r--r--apex/Android.bp57
-rw-r--r--apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java27
-rw-r--r--apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java10
-rw-r--r--apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java120
-rw-r--r--apex/media/framework/java/android/media/MediaParser.java53
-rw-r--r--apex/permission/framework/Android.bp98
-rw-r--r--apex/sdkextensions/Android.bp2
-rw-r--r--apex/sdkextensions/framework/Android.bp111
-rw-r--r--apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java11
9 files changed, 258 insertions, 231 deletions
diff --git a/apex/Android.bp b/apex/Android.bp
index 51e030bd174d..f511af570bb1 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -63,6 +63,63 @@ mainline_service_stubs_args =
"--hide-annotation android.annotation.Hide " +
"--hide InternalClasses " // com.android.* classes are okay in this interface
+// Defaults for mainline module provided java_sdk_library instances.
+java_defaults {
+ name: "framework-module-defaults",
+
+ // Additional annotations used for compiling both the implementation and the
+ // stubs libraries.
+ libs: ["framework-annotations-lib"],
+
+ // Enable api lint. This will eventually become the default for java_sdk_library
+ // but it cannot yet be turned on because some usages have not been cleaned up.
+ // TODO(b/156126315) - Remove when no longer needed.
+ api_lint: {
+ enabled: true,
+ },
+
+ // The API scope specific properties.
+ public: {
+ enabled: true,
+ sdk_version: "module_current",
+ },
+ system: {
+ enabled: true,
+ sdk_version: "module_current",
+ },
+ module_lib: {
+ enabled: true,
+ sdk_version: "module_current",
+ },
+
+ // Configure framework module specific metalava options.
+ droiddoc_options: [mainline_stubs_args],
+
+ // The stub libraries must be visible to frameworks/base so they can be combined
+ // into API specific libraries.
+ stubs_library_visibility: [
+ "//frameworks/base", // Framework
+ ],
+
+ // Set the visibility of the modules creating the stubs source.
+ stubs_source_visibility: [
+ // Ignore any visibility rules specified on the java_sdk_library when
+ // setting the visibility of the stubs source modules.
+ "//visibility:override",
+
+ // Currently, the stub source is not required for anything other than building
+ // the stubs library so is private to avoid misuse.
+ "//visibility:private",
+ ],
+
+ // Collates API usages from each module for further analysis.
+ plugins: ["java_api_finder"],
+
+ // Mainline modules should only rely on 'module_lib' APIs provided by other modules
+ // and the non updatable parts of the platform.
+ sdk_version: "module_current",
+}
+
stubs_defaults {
name: "framework-module-stubs-defaults-publicapi",
args: mainline_framework_stubs_args,
diff --git a/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
index 35a2436702da..9376198b8eaf 100644
--- a/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
+++ b/apex/blobstore/service/java/com/android/server/blob/BlobStoreManagerService.java
@@ -25,6 +25,7 @@ import static android.app.blob.XmlTags.TAG_SESSIONS;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
+import static android.os.UserHandle.USER_CURRENT;
import static android.os.UserHandle.USER_NULL;
import static com.android.server.blob.BlobStoreConfig.LOGV;
@@ -46,6 +47,8 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UserIdInt;
+import android.app.ActivityManager;
+import android.app.ActivityManagerInternal;
import android.app.blob.BlobHandle;
import android.app.blob.BlobInfo;
import android.app.blob.IBlobStoreManager;
@@ -1378,7 +1381,14 @@ public class BlobStoreManagerService extends SystemService {
+ "queryBlobsForUser()");
}
- return queryBlobsForUserInternal(userId);
+ final int resolvedUserId = userId == USER_CURRENT
+ ? ActivityManager.getCurrentUser() : userId;
+ // Don't allow any other special user ids apart from USER_CURRENT
+ final ActivityManagerInternal amInternal = LocalServices.getService(
+ ActivityManagerInternal.class);
+ amInternal.ensureNotSpecialUser(resolvedUserId);
+
+ return queryBlobsForUserInternal(resolvedUserId);
}
@Override
@@ -1479,12 +1489,13 @@ public class BlobStoreManagerService extends SystemService {
private static final int FLAG_DUMP_CONFIG = 1 << 2;
private int mSelectedSectionFlags;
- private boolean mDumpFull;
+ private boolean mDumpUnredacted;
private final ArrayList<String> mDumpPackages = new ArrayList<>();
private final ArrayList<Integer> mDumpUids = new ArrayList<>();
private final ArrayList<Integer> mDumpUserIds = new ArrayList<>();
private final ArrayList<Long> mDumpBlobIds = new ArrayList<>();
private boolean mDumpHelp;
+ private boolean mDumpAll;
public boolean shouldDumpSession(String packageName, int uid, long blobId) {
if (!CollectionUtils.isEmpty(mDumpPackages)
@@ -1503,7 +1514,7 @@ public class BlobStoreManagerService extends SystemService {
}
public boolean shouldDumpAllSections() {
- return mSelectedSectionFlags == 0;
+ return mDumpAll || (mSelectedSectionFlags == 0);
}
public void allowDumpSessions() {
@@ -1545,7 +1556,7 @@ public class BlobStoreManagerService extends SystemService {
}
public boolean shouldDumpFull() {
- return mDumpFull;
+ return mDumpUnredacted;
}
public boolean shouldDumpUser(int userId) {
@@ -1567,10 +1578,12 @@ public class BlobStoreManagerService extends SystemService {
for (int i = 0; i < args.length; ++i) {
final String opt = args[i];
- if ("--full".equals(opt) || "-f".equals(opt)) {
+ if ("--all".equals(opt) || "-a".equals(opt)) {
+ dumpArgs.mDumpAll = true;
+ } else if ("--unredacted".equals(opt) || "-u".equals(opt)) {
final int callingUid = Binder.getCallingUid();
if (callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID) {
- dumpArgs.mDumpFull = true;
+ dumpArgs.mDumpUnredacted = true;
}
} else if ("--sessions".equals(opt)) {
dumpArgs.allowDumpSessions();
@@ -1580,7 +1593,7 @@ public class BlobStoreManagerService extends SystemService {
dumpArgs.allowDumpConfig();
} else if ("--package".equals(opt) || "-p".equals(opt)) {
dumpArgs.mDumpPackages.add(getStringArgRequired(args, ++i, "packageName"));
- } else if ("--uid".equals(opt) || "-u".equals(opt)) {
+ } else if ("--uid".equals(opt)) {
dumpArgs.mDumpUids.add(getIntArgRequired(args, ++i, "uid"));
} else if ("--user".equals(opt)) {
dumpArgs.mDumpUserIds.add(getIntArgRequired(args, ++i, "userId"));
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
index 46d449a9257c..372ec981df02 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppIdleHistory.java
@@ -79,6 +79,12 @@ public class AppIdleHistory {
private static final int STANDBY_BUCKET_UNKNOWN = -1;
+ /**
+ * The bucket beyond which apps are considered idle. Any apps in this bucket or lower are
+ * considered idle while those in higher buckets are not considered idle.
+ */
+ static final int IDLE_BUCKET_CUTOFF = STANDBY_BUCKET_RARE;
+
@VisibleForTesting
static final String APP_IDLE_FILENAME = "app_idle_stats.xml";
private static final String TAG_PACKAGES = "packages";
@@ -350,7 +356,7 @@ public class AppIdleHistory {
ArrayMap<String, AppUsageHistory> userHistory = getUserHistory(userId);
AppUsageHistory appUsageHistory =
getPackageHistory(userHistory, packageName, elapsedRealtime, true);
- return appUsageHistory.currentBucket >= STANDBY_BUCKET_RARE;
+ return appUsageHistory.currentBucket >= IDLE_BUCKET_CUTOFF;
}
public AppUsageHistory getAppUsageHistory(String packageName, int userId,
@@ -487,7 +493,7 @@ public class AppIdleHistory {
final int newBucket;
final int reason;
if (idle) {
- newBucket = STANDBY_BUCKET_RARE;
+ newBucket = IDLE_BUCKET_CUTOFF;
reason = REASON_MAIN_FORCED_BY_USER;
} else {
newBucket = STANDBY_BUCKET_ACTIVE;
diff --git a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
index 980372d58f33..94e5d0b2591b 100644
--- a/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
+++ b/apex/jobscheduler/service/java/com/android/server/usage/AppStandbyController.java
@@ -54,6 +54,7 @@ import static com.android.server.SystemService.PHASE_BOOT_COMPLETED;
import static com.android.server.SystemService.PHASE_SYSTEM_SERVICES_READY;
import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.AppGlobals;
@@ -92,6 +93,7 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings.Global;
import android.telephony.TelephonyManager;
+import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.KeyValueListParser;
import android.util.Slog;
@@ -227,6 +229,13 @@ public class AppStandbyController implements AppStandbyInternal {
@GuardedBy("mActiveAdminApps")
private final SparseArray<Set<String>> mActiveAdminApps = new SparseArray<>();
+ /**
+ * Set of system apps that are headless (don't have any declared activities, enabled or
+ * disabled). Presence in this map indicates that the app is a headless system app.
+ */
+ @GuardedBy("mAppIdleLock")
+ private final ArrayMap<String, Boolean> mHeadlessSystemApps = new ArrayMap<>();
+
private final CountDownLatch mAdminDataAvailableLatch = new CountDownLatch(1);
// Messages for the handler
@@ -667,20 +676,22 @@ public class AppStandbyController implements AppStandbyInternal {
return;
}
}
- final boolean isSpecial = isAppSpecial(packageName,
+ final int minBucket = getAppMinBucket(packageName,
UserHandle.getAppId(uid),
userId);
if (DEBUG) {
- Slog.d(TAG, " Checking idle state for " + packageName + " special=" +
- isSpecial);
+ Slog.d(TAG, " Checking idle state for " + packageName
+ + " minBucket=" + minBucket);
}
- if (isSpecial) {
+ if (minBucket <= STANDBY_BUCKET_ACTIVE) {
+ // No extra processing needed for ACTIVE or higher since apps can't drop into lower
+ // buckets.
synchronized (mAppIdleLock) {
mAppIdleHistory.setAppStandbyBucket(packageName, userId, elapsedRealtime,
- STANDBY_BUCKET_EXEMPTED, REASON_MAIN_DEFAULT);
+ minBucket, REASON_MAIN_DEFAULT);
}
maybeInformListeners(packageName, userId, elapsedRealtime,
- STANDBY_BUCKET_EXEMPTED, REASON_MAIN_DEFAULT, false);
+ minBucket, REASON_MAIN_DEFAULT, false);
} else {
synchronized (mAppIdleLock) {
final AppIdleHistory.AppUsageHistory app =
@@ -761,6 +772,14 @@ public class AppStandbyController implements AppStandbyInternal {
Slog.d(TAG, "Bringing up from RESTRICTED to RARE due to off switch");
}
}
+ if (newBucket > minBucket) {
+ newBucket = minBucket;
+ // Leave the reason alone.
+ if (DEBUG) {
+ Slog.d(TAG, "Bringing up from " + newBucket + " to " + minBucket
+ + " due to min bucketing");
+ }
+ }
if (DEBUG) {
Slog.d(TAG, " Old bucket=" + oldBucket
+ ", newBucket=" + newBucket);
@@ -1027,20 +1046,35 @@ public class AppStandbyController implements AppStandbyInternal {
return isAppIdleFiltered(packageName, getAppId(packageName), userId, elapsedRealtime);
}
- private boolean isAppSpecial(String packageName, int appId, int userId) {
- if (packageName == null) return false;
+ @StandbyBuckets
+ private int getAppMinBucket(String packageName, int userId) {
+ try {
+ final int uid = mPackageManager.getPackageUidAsUser(packageName, userId);
+ return getAppMinBucket(packageName, UserHandle.getAppId(uid), userId);
+ } catch (PackageManager.NameNotFoundException e) {
+ // Not a valid package for this user, nothing to do
+ return STANDBY_BUCKET_NEVER;
+ }
+ }
+
+ /**
+ * Return the lowest bucket this app should ever enter.
+ */
+ @StandbyBuckets
+ private int getAppMinBucket(String packageName, int appId, int userId) {
+ if (packageName == null) return STANDBY_BUCKET_NEVER;
// If not enabled at all, of course nobody is ever idle.
if (!mAppIdleEnabled) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
if (appId < Process.FIRST_APPLICATION_UID) {
// System uids never go idle.
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
if (packageName.equals("android")) {
// Nor does the framework (which should be redundant with the above, but for MR1 we will
// retain this for safety).
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
if (mSystemServicesReady) {
try {
@@ -1048,42 +1082,50 @@ public class AppStandbyController implements AppStandbyInternal {
// for idle mode, because app idle (aka app standby) is really not as big an issue
// for controlling who participates vs. doze mode.
if (mInjector.isNonIdleWhitelisted(packageName)) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
if (isActiveDeviceAdmin(packageName, userId)) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
if (isActiveNetworkScorer(packageName)) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
if (mAppWidgetManager != null
&& mInjector.isBoundWidgetPackage(mAppWidgetManager, packageName, userId)) {
- return true;
+ return STANDBY_BUCKET_ACTIVE;
}
if (isDeviceProvisioningPackage(packageName)) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
}
// Check this last, as it can be the most expensive check
if (isCarrierApp(packageName)) {
- return true;
+ return STANDBY_BUCKET_EXEMPTED;
}
- return false;
+ if (isHeadlessSystemApp(packageName)) {
+ return STANDBY_BUCKET_ACTIVE;
+ }
+
+ return STANDBY_BUCKET_NEVER;
+ }
+
+ private boolean isHeadlessSystemApp(String packageName) {
+ return mHeadlessSystemApps.containsKey(packageName);
}
@Override
public boolean isAppIdleFiltered(String packageName, int appId, int userId,
long elapsedRealtime) {
- if (isAppSpecial(packageName, appId, userId)) {
+ if (getAppMinBucket(packageName, appId, userId) < AppIdleHistory.IDLE_BUCKET_CUTOFF) {
return false;
} else {
synchronized (mAppIdleLock) {
@@ -1423,6 +1465,8 @@ public class AppStandbyController implements AppStandbyInternal {
}
}
+ // Make sure we don't put the app in a lower bucket than it's supposed to be in.
+ newBucket = Math.min(newBucket, getAppMinBucket(packageName, userId));
mAppIdleHistory.setAppStandbyBucket(packageName, userId, elapsedRealtime, newBucket,
reason, resetTimeout);
}
@@ -1617,14 +1661,16 @@ public class AppStandbyController implements AppStandbyInternal {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
+ final String pkgName = intent.getData().getSchemeSpecificPart();
+ final int userId = getSendingUserId();
if (Intent.ACTION_PACKAGE_ADDED.equals(action)
|| Intent.ACTION_PACKAGE_CHANGED.equals(action)) {
clearCarrierPrivilegedApps();
+ // ACTION_PACKAGE_ADDED is called even for system app downgrades.
+ evaluateSystemAppException(pkgName, userId);
}
if ((Intent.ACTION_PACKAGE_REMOVED.equals(action) ||
Intent.ACTION_PACKAGE_ADDED.equals(action))) {
- final String pkgName = intent.getData().getSchemeSpecificPart();
- final int userId = getSendingUserId();
if (intent.getBooleanExtra(Intent.EXTRA_REPLACING, false)) {
maybeUnrestrictBuggyApp(pkgName, userId);
} else {
@@ -1634,6 +1680,34 @@ public class AppStandbyController implements AppStandbyInternal {
}
}
+ private void evaluateSystemAppException(String packageName, int userId) {
+ if (!mSystemServicesReady) {
+ // The app will be evaluated in initializeDefaultsForSystemApps() when possible.
+ return;
+ }
+ try {
+ PackageInfo pi = mPackageManager.getPackageInfoAsUser(packageName,
+ PackageManager.GET_ACTIVITIES | PackageManager.MATCH_DISABLED_COMPONENTS,
+ userId);
+ evaluateSystemAppException(pi);
+ } catch (PackageManager.NameNotFoundException e) {
+ mHeadlessSystemApps.remove(packageName);
+ }
+ }
+
+ private void evaluateSystemAppException(@Nullable PackageInfo pkgInfo) {
+ if (pkgInfo.applicationInfo != null && pkgInfo.applicationInfo.isSystemApp()) {
+ synchronized (mAppIdleLock) {
+ if (pkgInfo.activities == null || pkgInfo.activities.length == 0) {
+ // Headless system app.
+ mHeadlessSystemApps.put(pkgInfo.packageName, true);
+ } else {
+ mHeadlessSystemApps.remove(pkgInfo.packageName);
+ }
+ }
+ }
+ }
+
@Override
public void initializeDefaultsForSystemApps(int userId) {
if (!mSystemServicesReady) {
@@ -1645,7 +1719,7 @@ public class AppStandbyController implements AppStandbyInternal {
+ "appIdleEnabled=" + mAppIdleEnabled);
final long elapsedRealtime = mInjector.elapsedRealtime();
List<PackageInfo> packages = mPackageManager.getInstalledPackagesAsUser(
- PackageManager.MATCH_DISABLED_COMPONENTS,
+ PackageManager.GET_ACTIVITIES | PackageManager.MATCH_DISABLED_COMPONENTS,
userId);
final int packageCount = packages.size();
synchronized (mAppIdleLock) {
@@ -1658,6 +1732,8 @@ public class AppStandbyController implements AppStandbyInternal {
mAppIdleHistory.reportUsage(packageName, userId, STANDBY_BUCKET_ACTIVE,
REASON_SUB_USAGE_SYSTEM_UPDATE, 0,
elapsedRealtime + mSystemUpdateUsageTimeoutMillis);
+
+ evaluateSystemAppException(pi);
}
}
// Immediately persist defaults to disk
diff --git a/apex/media/framework/java/android/media/MediaParser.java b/apex/media/framework/java/android/media/MediaParser.java
index c3adf6044655..c1011ecb073b 100644
--- a/apex/media/framework/java/android/media/MediaParser.java
+++ b/apex/media/framework/java/android/media/MediaParser.java
@@ -21,6 +21,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.StringDef;
import android.media.MediaCodec.CryptoInfo;
+import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -467,7 +468,24 @@ public final class MediaParser {
public @interface SampleFlags {}
/** Indicates that the sample holds a synchronization sample. */
public static final int SAMPLE_FLAG_KEY_FRAME = MediaCodec.BUFFER_FLAG_KEY_FRAME;
- /** Indicates that the sample has supplemental data. */
+ /**
+ * Indicates that the sample has supplemental data.
+ *
+ * <p>Samples will not have this flag set unless the {@code
+ * "android.media.mediaparser.includeSupplementalData"} parameter is set to {@code true} via
+ * {@link #setParameter}.
+ *
+ * <p>Samples with supplemental data have the following sample data format:
+ *
+ * <ul>
+ * <li>If the {@code "android.media.mediaparser.inBandCryptoInfo"} parameter is set, all
+ * encryption information.
+ * <li>(4 bytes) {@code sample_data_size}: The size of the actual sample data, not including
+ * supplemental data or encryption information.
+ * <li>({@code sample_data_size} bytes): The media sample data.
+ * <li>(remaining bytes) The supplemental data.
+ * </ul>
+ */
public static final int SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA = 1 << 28;
/** Indicates that the sample is known to contain the last media sample of the stream. */
public static final int SAMPLE_FLAG_LAST_SAMPLE = 1 << 29;
@@ -578,7 +596,9 @@ public final class MediaParser {
PARAMETER_TS_IGNORE_AVC_STREAM,
PARAMETER_TS_IGNORE_SPLICE_INFO_STREAM,
PARAMETER_TS_DETECT_ACCESS_UNITS,
- PARAMETER_TS_ENABLE_HDMV_DTS_AUDIO_STREAMS
+ PARAMETER_TS_ENABLE_HDMV_DTS_AUDIO_STREAMS,
+ PARAMETER_IN_BAND_CRYPTO_INFO,
+ PARAMETER_INCLUDE_SUPPLEMENTAL_DATA
})
public @interface ParameterName {}
@@ -740,6 +760,16 @@ public final class MediaParser {
public static final String PARAMETER_IN_BAND_CRYPTO_INFO =
"android.media.mediaparser.inBandCryptoInfo";
+ /**
+ * Sets whether supplemental data should be included as part of the sample data. {@code boolean}
+ * expected. Default value is {@code false}. See {@link #SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA} for
+ * information about the sample data format.
+ *
+ * @hide
+ */
+ public static final String PARAMETER_INCLUDE_SUPPLEMENTAL_DATA =
+ "android.media.mediaparser.includeSupplementalData";
+
// Private constants.
private static final String TAG = "MediaParser";
@@ -899,6 +929,7 @@ public final class MediaParser {
private final ParsableByteArrayAdapter mScratchParsableByteArrayAdapter;
@Nullable private final Constructor<DrmInitData.SchemeInitData> mSchemeInitDataConstructor;
private boolean mInBandCryptoInfo;
+ private boolean mIncludeSupplementalData;
private String mParserName;
private Extractor mExtractor;
private ExtractorInput mExtractorInput;
@@ -949,6 +980,9 @@ public final class MediaParser {
if (PARAMETER_IN_BAND_CRYPTO_INFO.equals(parameterName)) {
mInBandCryptoInfo = (boolean) value;
}
+ if (PARAMETER_INCLUDE_SUPPLEMENTAL_DATA.equals(parameterName)) {
+ mIncludeSupplementalData = (boolean) value;
+ }
mParserParameters.put(parameterName, value);
return this;
}
@@ -1099,6 +1133,9 @@ public final class MediaParser {
// Private methods.
private MediaParser(OutputConsumer outputConsumer, boolean sniff, String... parserNamesPool) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
+ throw new UnsupportedOperationException("Android version must be R or greater.");
+ }
mParserParameters = new HashMap<>();
mOutputConsumer = outputConsumer;
mParserNamesPool = parserNamesPool;
@@ -1330,6 +1367,7 @@ public final class MediaParser {
private int mEncryptionVectorSize;
private boolean mHasSubsampleEncryptionData;
private CryptoInfo.Pattern mEncryptionPattern;
+ private int mSkippedSupplementalDataBytes;
private TrackOutputAdapter(int trackIndex) {
mTrackIndex = trackIndex;
@@ -1419,6 +1457,10 @@ public final class MediaParser {
throw new IllegalStateException();
}
}
+ } else if (sampleDataPart == SAMPLE_DATA_PART_SUPPLEMENTAL
+ && !mIncludeSupplementalData) {
+ mSkippedSupplementalDataBytes += length;
+ data.skipBytes(length);
} else {
outputSampleData(data, length);
}
@@ -1427,6 +1469,8 @@ public final class MediaParser {
@Override
public void sampleMetadata(
long timeUs, int flags, int size, int offset, @Nullable CryptoData cryptoData) {
+ size -= mSkippedSupplementalDataBytes;
+ mSkippedSupplementalDataBytes = 0;
mOutputConsumer.onSampleCompleted(
mTrackIndex,
timeUs,
@@ -1686,13 +1730,13 @@ public final class MediaParser {
}
}
- private static int getMediaParserFlags(int flags) {
+ private int getMediaParserFlags(int flags) {
@SampleFlags int result = 0;
result |= (flags & C.BUFFER_FLAG_ENCRYPTED) != 0 ? SAMPLE_FLAG_ENCRYPTED : 0;
result |= (flags & C.BUFFER_FLAG_KEY_FRAME) != 0 ? SAMPLE_FLAG_KEY_FRAME : 0;
result |= (flags & C.BUFFER_FLAG_DECODE_ONLY) != 0 ? SAMPLE_FLAG_DECODE_ONLY : 0;
result |=
- (flags & C.BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA) != 0
+ (flags & C.BUFFER_FLAG_HAS_SUPPLEMENTAL_DATA) != 0 && mIncludeSupplementalData
? SAMPLE_FLAG_HAS_SUPPLEMENTAL_DATA
: 0;
result |= (flags & C.BUFFER_FLAG_LAST_SAMPLE) != 0 ? SAMPLE_FLAG_LAST_SAMPLE : 0;
@@ -1755,6 +1799,7 @@ public final class MediaParser {
expectedTypeByParameterName.put(PARAMETER_TS_DETECT_ACCESS_UNITS, Boolean.class);
expectedTypeByParameterName.put(PARAMETER_TS_ENABLE_HDMV_DTS_AUDIO_STREAMS, Boolean.class);
expectedTypeByParameterName.put(PARAMETER_IN_BAND_CRYPTO_INFO, Boolean.class);
+ expectedTypeByParameterName.put(PARAMETER_INCLUDE_SUPPLEMENTAL_DATA, Boolean.class);
EXPECTED_TYPE_BY_PARAMETER_NAME = Collections.unmodifiableMap(expectedTypeByParameterName);
}
}
diff --git a/apex/permission/framework/Android.bp b/apex/permission/framework/Android.bp
index 68c27a8327cb..c43fabde81da 100644
--- a/apex/permission/framework/Android.bp
+++ b/apex/permission/framework/Android.bp
@@ -21,12 +21,18 @@ filegroup {
path: "java",
}
-java_library {
+java_sdk_library {
name: "framework-permission",
+ defaults: ["framework-module-defaults"],
srcs: [
":framework-permission-sources",
],
- sdk_version: "module_current",
+
+ // TODO(b/155480189) - Remove naming_scheme once references have been resolved.
+ // Temporary java_sdk_library component naming scheme to use to ease the transition from separate
+ // modules to java_sdk_library.
+ naming_scheme: "framework-modules",
+
apex_available: [
"com.android.permission",
"test_com.android.permission",
@@ -40,91 +46,5 @@ java_library {
visibility: [
"//frameworks/base/apex/permission:__subpackages__",
],
-}
-
-stubs_defaults {
- name: "framework-permission-stubs-defaults",
- srcs: [ ":framework-permission-sources" ],
- libs: [ "framework-annotations-lib" ],
- dist: { dest: "framework-permission.txt" },
-}
-
-droidstubs {
- name: "framework-permission-stubs-srcs-publicapi",
- defaults: [
- "framework-module-stubs-defaults-publicapi",
- "framework-permission-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-permission.api.public.latest",
- removed_api_file: ":framework-permission-removed.api.public.latest",
- },
- api_lint: {
- new_since: ":framework-permission.api.public.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-permission-stubs-srcs-systemapi",
- defaults: [
- "framework-module-stubs-defaults-systemapi",
- "framework-permission-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-permission.api.system.latest",
- removed_api_file: ":framework-permission-removed.api.system.latest",
- },
- api_lint: {
- new_since: ":framework-permission.api.system.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-permission-api-module_libs_api",
- defaults: [
- "framework-module-api-defaults-module_libs_api",
- "framework-permission-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-permission.api.module-lib.latest",
- removed_api_file: ":framework-permission-removed.api.module-lib.latest",
- },
- api_lint: {
- new_since: ":framework-permission.api.module-lib.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-permission-stubs-srcs-module_libs_api",
- defaults: [
- "framework-module-stubs-defaults-module_libs_api",
- "framework-permission-stubs-defaults",
- ],
-}
-
-java_library {
- name: "framework-permission-stubs-publicapi",
- srcs: [ ":framework-permission-stubs-srcs-publicapi" ],
- defaults: ["framework-module-stubs-lib-defaults-publicapi"],
- dist: { dest: "framework-permission.jar" },
-}
-
-java_library {
- name: "framework-permission-stubs-systemapi",
- srcs: [ ":framework-permission-stubs-srcs-systemapi" ],
- defaults: ["framework-module-stubs-lib-defaults-systemapi"],
- dist: { dest: "framework-permission.jar" },
-}
-
-java_library {
- name: "framework-permission-stubs-module_libs_api",
- srcs: [ ":framework-permission-stubs-srcs-module_libs_api" ],
- defaults: ["framework-module-stubs-lib-defaults-module_libs_api"],
- dist: { dest: "framework-permission.jar" },
+ stubs_library_visibility: ["//visibility:public"],
}
diff --git a/apex/sdkextensions/Android.bp b/apex/sdkextensions/Android.bp
index dbb5bd3d660f..fdb078e00d92 100644
--- a/apex/sdkextensions/Android.bp
+++ b/apex/sdkextensions/Android.bp
@@ -39,7 +39,7 @@ apex_defaults {
sdk {
name: "sdkextensions-sdk",
- java_header_libs: [ "framework-sdkextensions-stubs-systemapi" ],
+ java_sdk_libs: [ "framework-sdkextensions" ],
}
apex_key {
diff --git a/apex/sdkextensions/framework/Android.bp b/apex/sdkextensions/framework/Android.bp
index 14e23ed9a8a1..b8aad7d8204f 100644
--- a/apex/sdkextensions/framework/Android.bp
+++ b/apex/sdkextensions/framework/Android.bp
@@ -25,14 +25,18 @@ filegroup {
visibility: [ "//frameworks/base" ] // For the "global" stubs.
}
-java_library {
+java_sdk_library {
name: "framework-sdkextensions",
srcs: [ ":framework-sdkextensions-sources" ],
- sdk_version: "system_current",
- libs: [ "framework-annotations-lib" ],
+ defaults: ["framework-module-defaults"],
+
+ // TODO(b/155480189) - Remove naming_scheme once references have been resolved.
+ // Temporary java_sdk_library component naming scheme to use to ease the transition from separate
+ // modules to java_sdk_library.
+ naming_scheme: "framework-modules",
+
permitted_packages: [ "android.os.ext" ],
installable: true,
- plugins: ["java_api_finder"],
visibility: [
"//frameworks/base/apex/sdkextensions",
"//frameworks/base/apex/sdkextensions/testing",
@@ -43,102 +47,3 @@ java_library {
"test_com.android.sdkext",
],
}
-
-stubs_defaults {
- name: "framework-sdkextensions-stubs-defaults",
- srcs: [ ":framework-sdkextensions-sources" ],
- libs: [ "framework-annotations-lib" ],
- dist: { dest: "framework-sdkextensions.txt" },
-}
-
-droidstubs {
- name: "framework-sdkextensions-stubs-srcs-publicapi",
- defaults: [
- "framework-module-stubs-defaults-publicapi",
- "framework-sdkextensions-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-sdkextensions.api.public.latest",
- removed_api_file: ":framework-sdkextensions-removed.api.public.latest",
- },
- api_lint: {
- new_since: ":framework-sdkextensions.api.public.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-sdkextensions-stubs-srcs-systemapi",
- defaults: [
- "framework-module-stubs-defaults-systemapi",
- "framework-sdkextensions-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-sdkextensions.api.system.latest",
- removed_api_file: ":framework-sdkextensions-removed.api.system.latest",
- },
- api_lint: {
- new_since: ":framework-sdkextensions.api.system.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-sdkextensions-api-module_libs_api",
- defaults: [
- "framework-module-api-defaults-module_libs_api",
- "framework-sdkextensions-stubs-defaults",
- ],
- check_api: {
- last_released: {
- api_file: ":framework-sdkextensions.api.module-lib.latest",
- removed_api_file: ":framework-sdkextensions-removed.api.module-lib.latest",
- },
- api_lint: {
- new_since: ":framework-sdkextensions.api.module-lib.latest",
- },
- },
-}
-
-droidstubs {
- name: "framework-sdkextensions-stubs-srcs-module_libs_api",
- defaults: [
- "framework-module-stubs-defaults-module_libs_api",
- "framework-sdkextensions-stubs-defaults",
- ],
-}
-
-java_library {
- name: "framework-sdkextensions-stubs-publicapi",
- srcs: [":framework-sdkextensions-stubs-srcs-publicapi"],
- defaults: ["framework-module-stubs-lib-defaults-publicapi"],
- visibility: [
- "//frameworks/base", // Framework
- "//frameworks/base/apex/sdkextensions", // sdkextensions SDK
- ],
- dist: { dest: "framework-sdkextensions.jar" },
-}
-
-java_library {
- name: "framework-sdkextensions-stubs-systemapi",
- srcs: [":framework-sdkextensions-stubs-srcs-systemapi"],
- defaults: ["framework-module-stubs-lib-defaults-systemapi"],
- visibility: [
- "//frameworks/base", // Framework
- "//frameworks/base/apex/sdkextensions", // sdkextensions SDK
- ],
- dist: { dest: "framework-sdkextensions.jar" },
-}
-
-java_library {
- name: "framework-sdkextensions-stubs-module_libs_api",
- srcs: [":framework-sdkextensions-stubs-srcs-module_libs_api"],
- defaults: ["framework-module-stubs-lib-defaults-module_libs_api"],
- visibility: [
- "//frameworks/base", // Framework
- "//frameworks/base/apex/sdkextensions", // sdkextensions SDK
- ],
- dist: { dest: "framework-sdkextensions.jar" },
-}
diff --git a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
index 5cf5e0b1d182..cbc8ed636ff2 100644
--- a/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
+++ b/apex/statsd/service/java/com/android/server/stats/StatsCompanionService.java
@@ -662,14 +662,19 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
return;
}
+ // Cleann up from previous statsd - cancel any alarms that had been set. Do this here
+ // instead of in binder death because statsd can come back and set different alarms, or not
+ // want to set an alarm when it had been set. This guarantees that when we get a new statsd,
+ // we cancel any alarms before it is able to set them.
+ cancelAnomalyAlarm();
+ cancelPullingAlarm();
+ cancelAlarmForSubscriberTriggering();
+
if (DEBUG) Log.d(TAG, "Saying hi to statsd");
mStatsManagerService.statsdReady(statsd);
try {
statsd.statsCompanionReady();
- cancelAnomalyAlarm();
- cancelPullingAlarm();
-
BroadcastReceiver appUpdateReceiver = new AppUpdateReceiver();
BroadcastReceiver userUpdateReceiver = new UserUpdateReceiver();
BroadcastReceiver shutdownEventReceiver = new ShutdownEventReceiver();