Skip to content

Commit f049cfd

Browse files
author
android-build-team Robot
committed
Snap for 6544675 from 289a482 to rvc-release
Change-Id: Ibe75e02be15cf79d694b4db44db2d750323082c2
2 parents 678e213 + 289a482 commit f049cfd

145 files changed

Lines changed: 3094 additions & 1439 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apex/media/framework/Android.bp

Lines changed: 15 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -83,98 +83,31 @@ filegroup {
8383
"java/android/media/MediaParser.java"
8484
],
8585
path: "java",
86-
}
86+
}
8787

88-
stubs_defaults {
89-
name: "framework-media-stubs-srcs-defaults",
90-
srcs: [ ":updatable-media-srcs" ],
91-
libs: [ "framework_media_annotation" ],
92-
aidl: {
93-
// TODO(b/135922046) remove this
94-
include_dirs: ["frameworks/base/core/java"],
95-
},
96-
dist: { dest: "framework-media.txt" },
97-
}
88+
java_sdk_library {
89+
name: "framework-media",
90+
defaults: ["framework-module-defaults"],
9891

99-
droidstubs {
100-
name: "framework-media-stubs-srcs-publicapi",
101-
defaults: [
102-
"framework-media-stubs-srcs-defaults",
103-
"framework-module-stubs-defaults-publicapi",
104-
],
105-
check_api: {
106-
last_released: {
107-
api_file: ":framework-media.api.public.latest",
108-
removed_api_file: ":framework-media-removed.api.public.latest",
109-
},
110-
api_lint: {
111-
new_since: ":framework-media.api.public.latest",
112-
},
113-
},
114-
}
92+
// This is only used to define the APIs for updatable-media.
93+
api_only: true,
11594

116-
droidstubs {
117-
name: "framework-media-stubs-srcs-systemapi",
118-
defaults: [
119-
"framework-media-stubs-srcs-defaults",
120-
"framework-module-stubs-defaults-systemapi",
95+
srcs: [
96+
":updatable-media-srcs",
12197
],
122-
check_api: {
123-
last_released: {
124-
api_file: ":framework-media.api.system.latest",
125-
removed_api_file: ":framework-media-removed.api.system.latest",
126-
},
127-
api_lint: {
128-
new_since: ":framework-media.api.system.latest",
129-
},
130-
},
131-
}
13298

133-
droidstubs {
134-
name: "framework-media-api-module_libs_api",
135-
defaults: [
136-
"framework-media-stubs-srcs-defaults",
137-
"framework-module-api-defaults-module_libs_api",
138-
],
139-
check_api: {
140-
last_released: {
141-
api_file: ":framework-media.api.module-lib.latest",
142-
removed_api_file: ":framework-media-removed.api.module-lib.latest",
143-
},
144-
api_lint: {
145-
new_since: ":framework-media.api.module-lib.latest",
146-
},
147-
},
148-
}
99+
// TODO(b/155480189) - Remove naming_scheme once references have been resolved.
100+
// Temporary java_sdk_library component naming scheme to use to ease the transition from separate
101+
// modules to java_sdk_library.
102+
naming_scheme: "framework-modules",
149103

150-
droidstubs {
151-
name: "framework-media-stubs-srcs-module_libs_api",
152-
defaults: [
153-
"framework-media-stubs-srcs-defaults",
154-
"framework-module-stubs-defaults-module_libs_api",
104+
libs: [
105+
"framework_media_annotation",
155106
],
156-
}
157107

158-
java_library {
159-
name: "framework-media-stubs-publicapi",
160-
srcs: [":framework-media-stubs-srcs-publicapi"],
161-
defaults: ["framework-module-stubs-lib-defaults-publicapi"],
162-
dist: { dest: "framework-media.jar" },
163-
}
164-
165-
java_library {
166-
name: "framework-media-stubs-systemapi",
167-
srcs: [":framework-media-stubs-srcs-systemapi"],
168-
defaults: ["framework-module-stubs-lib-defaults-systemapi"],
169-
dist: { dest: "framework-media.jar" },
108+
visibility: ["//frameworks/av/apex:__subpackages__"],
170109
}
171110

172-
java_library {
173-
name: "framework-media-stubs-module_libs_api",
174-
srcs: [":framework-media-stubs-srcs-module_libs_api"],
175-
defaults: ["framework-module-stubs-lib-defaults-module_libs_api"],
176-
dist: { dest: "framework-media.jar" },
177-
}
178111

179112
java_library {
180113
name: "framework_media_annotation",

apex/statsd/Android.bp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ prebuilt_etc {
6262
cc_library_shared {
6363
name: "libstats_jni",
6464
srcs: ["jni/**/*.cpp"],
65+
header_libs: ["libnativehelper_header_only"],
6566
shared_libs: [
66-
"libnativehelper", // Has stable abi - should not be copied into apex.
6767
"liblog", // Has a stable abi - should not be copied into apex.
6868
"libstatssocket",
6969
],

apex/statsd/framework/java/android/app/StatsManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public final class StatsManager {
120120
/**
121121
* @hide
122122
**/
123-
@VisibleForTesting public static final long DEFAULT_TIMEOUT_MILLIS = 10_000L; // 10 seconds.
123+
@VisibleForTesting public static final long DEFAULT_TIMEOUT_MILLIS = 2_000L; // 2 seconds.
124124

125125
/**
126126
* Constructor for StatsManagerClient.

apex/statsd/jni/android_util_StatsLog.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#define LOG_NAMESPACE "StatsLog.tag."
1818
#define LOG_TAG "StatsLog_println"
1919

20-
#include "jni.h"
20+
#include <jni.h>
2121
#include <log/log.h>
22-
#include <nativehelper/JNIHelp.h>
22+
#include <nativehelper/scoped_local_ref.h>
2323
#include "stats_buffer_writer.h"
2424

2525
namespace android {
@@ -54,27 +54,37 @@ static const JNINativeMethod gMethods[] = {
5454

5555
int register_android_util_StatsLog(JNIEnv* env)
5656
{
57-
return jniRegisterNativeMethods(env, "android/util/StatsLog", gMethods, NELEM(gMethods));
57+
static const char* kStatsLogClass = "android/util/StatsLog";
58+
59+
ScopedLocalRef<jclass> cls(env, env->FindClass(kStatsLogClass));
60+
if (cls.get() == nullptr) {
61+
ALOGE("jni statsd registration failure, class not found '%s'", kStatsLogClass);
62+
return JNI_ERR;
63+
}
64+
65+
const jint count = sizeof(gMethods) / sizeof(gMethods[0]);
66+
int status = env->RegisterNatives(cls.get(), gMethods, count);
67+
if (status < 0) {
68+
ALOGE("jni statsd registration failure, status: %d", status);
69+
return JNI_ERR;
70+
}
71+
return JNI_VERSION_1_4;
5872
}
73+
5974
}; // namespace android
6075

6176
/*
6277
* JNI Initialization
6378
*/
6479
jint JNI_OnLoad(JavaVM* jvm, void* reserved) {
6580
JNIEnv* e;
66-
int status;
6781

6882
ALOGV("statsd : loading JNI\n");
6983
// Check JNI version
7084
if (jvm->GetEnv((void**)&e, JNI_VERSION_1_4)) {
7185
ALOGE("JNI version mismatch error");
7286
return JNI_ERR;
7387
}
74-
status = android::register_android_util_StatsLog(e);
75-
if (status < 0) {
76-
ALOGE("jni statsd registration failure, status: %d", status);
77-
return JNI_ERR;
78-
}
79-
return JNI_VERSION_1_4;
88+
89+
return android::register_android_util_StatsLog(e);
8090
}

cmds/statsd/src/condition/CombinationConditionTracker.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,14 @@ void CombinationConditionTracker::evaluateCondition(
141141
ConditionState newCondition =
142142
evaluateCombinationCondition(mChildren, mLogicalOperation, nonSlicedConditionCache);
143143
if (!mSliced) {
144+
bool nonSlicedChanged = (mUnSlicedPartCondition != newCondition);
145+
mUnSlicedPartCondition = newCondition;
144146

145-
bool nonSlicedChanged = (mNonSlicedConditionState != newCondition);
146-
mNonSlicedConditionState = newCondition;
147-
148-
nonSlicedConditionCache[mIndex] = mNonSlicedConditionState;
149-
147+
nonSlicedConditionCache[mIndex] = mUnSlicedPartCondition;
150148
conditionChangedCache[mIndex] = nonSlicedChanged;
151-
mUnSlicedPart = newCondition;
152149
} else {
153-
mUnSlicedPart = evaluateCombinationCondition(
154-
mUnSlicedChildren, mLogicalOperation, nonSlicedConditionCache);
150+
mUnSlicedPartCondition = evaluateCombinationCondition(mUnSlicedChildren, mLogicalOperation,
151+
nonSlicedConditionCache);
155152

156153
for (const int childIndex : mChildren) {
157154
// If any of the sliced condition in children condition changes, the combination

cmds/statsd/src/condition/ConditionTracker.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ConditionTracker : public virtual RefBase {
3636
mIndex(index),
3737
mInitialized(false),
3838
mTrackerIndex(),
39-
mNonSlicedConditionState(ConditionState::kUnknown),
39+
mUnSlicedPartCondition(ConditionState::kUnknown),
4040
mSliced(false){};
4141

4242
virtual ~ConditionTracker(){};
@@ -72,11 +72,6 @@ class ConditionTracker : public virtual RefBase {
7272
std::vector<ConditionState>& conditionCache,
7373
std::vector<bool>& conditionChanged) = 0;
7474

75-
// Return the current condition state.
76-
virtual ConditionState isConditionMet() const {
77-
return mNonSlicedConditionState;
78-
};
79-
8075
// Query the condition with parameters.
8176
// [conditionParameters]: a map from condition name to the HashableDimensionKey to query the
8277
// condition.
@@ -125,8 +120,9 @@ class ConditionTracker : public virtual RefBase {
125120
const std::vector<sp<ConditionTracker>>& allConditions,
126121
const vector<Matcher>& dimensions) const = 0;
127122

123+
// Return the current condition state of the unsliced part of the condition.
128124
inline ConditionState getUnSlicedPartConditionState() const {
129-
return mUnSlicedPart;
125+
return mUnSlicedPartCondition;
130126
}
131127

132128
protected:
@@ -141,10 +137,16 @@ class ConditionTracker : public virtual RefBase {
141137
// the list of LogMatchingTracker index that this ConditionTracker uses.
142138
std::set<int> mTrackerIndex;
143139

144-
ConditionState mNonSlicedConditionState;
140+
// This variable is only used for CombinationConditionTrackers.
141+
// SimpleConditionTrackers technically don't have an unsliced part because
142+
// they are either sliced or unsliced.
143+
//
144+
// CombinationConditionTrackers have multiple children ConditionTrackers
145+
// that can be a mixture of sliced or unsliced. This tracks the
146+
// condition of the unsliced part of the combination condition.
147+
ConditionState mUnSlicedPartCondition;
145148

146149
bool mSliced;
147-
ConditionState mUnSlicedPart;
148150
};
149151

150152
} // namespace statsd

cmds/statsd/src/condition/SimpleConditionTracker.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ SimpleConditionTracker::SimpleConditionTracker(
8585
mInitialValue = ConditionState::kUnknown;
8686
}
8787

88-
mNonSlicedConditionState = mInitialValue;
89-
90-
if (!mSliced) {
91-
mUnSlicedPart = mInitialValue;
92-
}
93-
9488
mInitialized = true;
9589
}
9690

@@ -141,9 +135,6 @@ void SimpleConditionTracker::handleStopAll(std::vector<ConditionState>& conditio
141135
mInitialValue = ConditionState::kFalse;
142136
mSlicedConditionState.clear();
143137
conditionCache[mIndex] = ConditionState::kFalse;
144-
if (!mSliced) {
145-
mUnSlicedPart = ConditionState::kFalse;
146-
}
147138
}
148139

149140
bool SimpleConditionTracker::hitGuardRail(const HashableDimensionKey& newKey) {
@@ -305,9 +296,7 @@ void SimpleConditionTracker::evaluateCondition(
305296
conditionCache[mIndex] =
306297
itr->second > 0 ? ConditionState::kTrue : ConditionState::kFalse;
307298
}
308-
mUnSlicedPart = conditionCache[mIndex];
309299
}
310-
311300
return;
312301
}
313302

@@ -333,9 +322,6 @@ void SimpleConditionTracker::evaluateCondition(
333322
}
334323
conditionCache[mIndex] = overallState;
335324
conditionChangedCache[mIndex] = overallChanged;
336-
if (!mSliced) {
337-
mUnSlicedPart = overallState;
338-
}
339325
}
340326

341327
void SimpleConditionTracker::isConditionMet(

cmds/statsd/src/metrics/MetricProducer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ void MetricProducer::mapStateValue(const int32_t atomId, FieldValue* value) {
293293
}
294294
}
295295

296+
HashableDimensionKey MetricProducer::getUnknownStateKey() {
297+
HashableDimensionKey stateKey;
298+
for (auto atom : mSlicedStateAtoms) {
299+
FieldValue fieldValue;
300+
fieldValue.mField.setTag(atom);
301+
fieldValue.mValue.setInt(StateTracker::kStateUnknown);
302+
stateKey.addValue(fieldValue);
303+
}
304+
return stateKey;
305+
}
306+
296307
DropEvent MetricProducer::buildDropEvent(const int64_t dropTimeNs, const BucketDropReason reason) {
297308
DropEvent event;
298309
event.reason = reason;

cmds/statsd/src/metrics/MetricProducer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ class MetricProducer : public virtual android::RefBase, public virtual StateList
386386
// If no state map exists, keep the original state value.
387387
void mapStateValue(const int32_t atomId, FieldValue* value);
388388

389+
// Returns a HashableDimensionKey with unknown state value for each state
390+
// atom.
391+
HashableDimensionKey getUnknownStateKey();
392+
389393
DropEvent buildDropEvent(const int64_t dropTimeNs, const BucketDropReason reason);
390394

391395
// Returns true if the number of drop events in the current bucket has

0 commit comments

Comments
 (0)