Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bd33a69c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4784261 from 037834d5 to pi-release

Change-Id: If699bf35aa77c7c0aeca814b9c02cf155159fa69
parents c36d8a4d 037834d5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -564,6 +564,11 @@ package android.net {
    field public static final int INVALID_SECURITY_PARAMETER_INDEX = 0; // 0x0
  }

  public final class NetworkCapabilities implements android.os.Parcelable {
    method public int[] getCapabilities();
    method public int[] getTransportTypes();
  }

  public class TrafficStats {
    method public static long getLoopbackRxBytes();
    method public static long getLoopbackRxPackets();
+5 −2
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ public:
                          const int64_t version) override {
        std::lock_guard<std::mutex> lock(mMutex);

        if (mPullTagId != -1) {
        if (mPullTagId != -1 && (mCondition == true || mConditionTrackerIndex < 0) ) {
            vector<shared_ptr<LogEvent>> allData;
            mStatsPullerManager->Pull(mPullTagId, eventTimeNs, &allData);
            if (allData.size() == 0) {
@@ -73,7 +73,9 @@ public:
                data->setElapsedTimestampNs(eventTimeNs);
                onMatchedLogEventLocked(0, *data);
            }
        } else {  // For pushed value metric, we simply flush and reset the current bucket start.
        } else {
            // For pushed value metric or pulled metric where condition is not true,
            // we simply flush and reset the current bucket start.
            flushCurrentBucketLocked(eventTimeNs);
            mCurrentBucketStartTimeNs = eventTimeNs;
        }
@@ -170,6 +172,7 @@ private:
    FRIEND_TEST(ValueMetricProducerTest, TestEventsWithNonSlicedCondition);
    FRIEND_TEST(ValueMetricProducerTest, TestPushedEventsWithUpgrade);
    FRIEND_TEST(ValueMetricProducerTest, TestPulledValueWithUpgrade);
    FRIEND_TEST(ValueMetricProducerTest, TestPulledValueWithUpgradeWhileConditionFalse);
    FRIEND_TEST(ValueMetricProducerTest, TestPushedEventsWithoutCondition);
    FRIEND_TEST(ValueMetricProducerTest, TestAnomalyDetection);
    FRIEND_TEST(ValueMetricProducerTest, TestBucketBoundaryNoCondition);
+51 −0
Original line number Diff line number Diff line
@@ -308,6 +308,57 @@ TEST(ValueMetricProducerTest, TestPulledValueWithUpgrade) {
    EXPECT_EQ(30L, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][1].mValue);
}

TEST(ValueMetricProducerTest, TestPulledValueWithUpgradeWhileConditionFalse) {
    ValueMetric metric;
    metric.set_id(metricId);
    metric.set_bucket(ONE_MINUTE);
    metric.mutable_value_field()->set_field(tagId);
    metric.mutable_value_field()->add_child()->set_field(2);
    metric.set_condition(StringToId("SCREEN_ON"));

    sp<MockConditionWizard> wizard = new NaggyMock<MockConditionWizard>();
    shared_ptr<MockStatsPullerManager> pullerManager =
            make_shared<StrictMock<MockStatsPullerManager>>();
    EXPECT_CALL(*pullerManager, RegisterReceiver(tagId, _, _, _)).WillOnce(Return());
    EXPECT_CALL(*pullerManager, UnRegisterReceiver(tagId, _)).WillOnce(Return());
    EXPECT_CALL(*pullerManager, Pull(tagId, _, _))
            .WillOnce(Invoke([](int tagId, int64_t timeNs,
                                vector<std::shared_ptr<LogEvent>>* data) {
                data->clear();
                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
                event->write(tagId);
                event->write(100);
                event->init();
                data->push_back(event);
                return true;
            }))
            .WillOnce(Invoke([](int tagId, int64_t timeNs,
                                vector<std::shared_ptr<LogEvent>>* data) {
                data->clear();
                shared_ptr<LogEvent> event = make_shared<LogEvent>(tagId, bucketStartTimeNs + 10);
                event->write(tagId);
                event->write(120);
                event->init();
                data->push_back(event);
                return true;
            }));
    ValueMetricProducer valueProducer(kConfigKey, metric, 1, wizard, tagId, bucketStartTimeNs,
                                      bucketStartTimeNs, pullerManager);
    valueProducer.setBucketSize(60 * NS_PER_SEC);
    valueProducer.onConditionChanged(true, bucketStartTimeNs + 1);

    valueProducer.onConditionChanged(false, bucket2StartTimeNs-100);
    EXPECT_FALSE(valueProducer.mCondition);

    valueProducer.notifyAppUpgrade(bucket2StartTimeNs-50, "ANY.APP", 1, 1);
    // Expect one full buckets already done and starting a partial bucket.
    EXPECT_EQ(bucket2StartTimeNs-50, valueProducer.mCurrentBucketStartTimeNs);
    EXPECT_EQ(1UL, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY].size());
    EXPECT_EQ(bucketStartTimeNs, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mBucketStartNs);
    EXPECT_EQ(20L, valueProducer.mPastBuckets[DEFAULT_METRIC_DIMENSION_KEY][0].mValue);
    EXPECT_FALSE(valueProducer.mCondition);
}

TEST(ValueMetricProducerTest, TestPushedEventsWithoutCondition) {
    ValueMetric metric;
    metric.set_id(metricId);
+1 −2
Original line number Diff line number Diff line
@@ -3208,8 +3208,6 @@ Landroid/net/NetworkAgent;->sendNetworkInfo(Landroid/net/NetworkInfo;)V
Landroid/net/NetworkCapabilities;-><init>()V
Landroid/net/NetworkCapabilities;->addCapability(I)Landroid/net/NetworkCapabilities;
Landroid/net/NetworkCapabilities;->addTransportType(I)Landroid/net/NetworkCapabilities;
Landroid/net/NetworkCapabilities;->getCapabilities()[I
Landroid/net/NetworkCapabilities;->getTransportTypes()[I
Landroid/net/NetworkCapabilities;->mNetworkCapabilities:J
Landroid/net/NetworkCapabilities;->mSignalStrength:I
Landroid/net/NetworkCapabilities;->removeCapability(I)Landroid/net/NetworkCapabilities;
@@ -6664,6 +6662,7 @@ Landroid/widget/RemoteViews;->mBitmapCache:Landroid/widget/RemoteViews$BitmapCac
Landroid/widget/RemoteViews;->mergeRemoteViews(Landroid/widget/RemoteViews;)V
Landroid/widget/RemoteViews;->mLayoutId:I
Landroid/widget/RemoteViews;->mPortrait:Landroid/widget/RemoteViews;
Landroid/widget/RemoteViews;->setIsWidgetCollectionChild(Z)V
Landroid/widget/RemoteViews;->setRemoteAdapter(ILjava/util/ArrayList;I)V
Landroid/widget/RemoteViewsAdapter;->getRemoteViewsServiceIntent()Landroid/content/Intent;
Landroid/widget/RemoteViewsAdapter;->isDataReady()Z
+1 −1
Original line number Diff line number Diff line
@@ -700,7 +700,7 @@ public final class LoadedApk {
                        librarySearchPath, libraryPermittedPath, mBaseClassLoader,
                        null /* classLoaderName */);
                StrictMode.setThreadPolicy(oldPolicy);
                mAppComponentFactory = createAppFactory(mApplicationInfo, mClassLoader);
                mAppComponentFactory = AppComponentFactory.DEFAULT;
            }

            return;
Loading