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

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

Snap for 5633838 from 0906e02a to qt-release

Change-Id: Ia36c97e474bf8a4bc3d9353c4de36fa2e884afe6
parents aa3dad82 0906e02a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -69,7 +69,10 @@ struct InputOverlay {

bool VendorIsQOrLater() {
  constexpr int kQSdkVersion = 29;
  int version = std::atoi(android::base::GetProperty("ro.vndk.version", "29").data());
  constexpr int kBase = 10;
  std::string version_prop = android::base::GetProperty("ro.vndk.version", "29");
  int version = strtol(version_prop.data(), nullptr, kBase);

  // If the string cannot be parsed, it is a development sdk codename.
  return version >= kQSdkVersion || version == 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -442,7 +442,7 @@ void StorageManager::appendConfigMetricsReport(const ConfigKey& key, ProtoOutput

        if (erase_data) {
            remove(fullPathName.c_str());
        } else if (output.mIsHistory && !isAdb) {
        } else if (!output.mIsHistory && !isAdb) {
            // This means a real data owner has called to get this data. But the config says it
            // wants to keep a local history. So now this file must be renamed as a history file.
            // So that next time, when owner calls getData() again, this data won't be uploaded
+99 −0
Original line number Diff line number Diff line
@@ -125,6 +125,105 @@ TEST(StorageManagerTest, SortFileTest) {
    EXPECT_EQ("300_2000_123454_history", list[3].mFileName);
}

const string testDir = "/data/misc/stats-data/";
const string file1 = testDir + "2557169347_1066_1";
const string file2 = testDir + "2557169349_1066_1";
const string file1_history = file1 + "_history";
const string file2_history = file2 + "_history";

bool prepareLocalHistoryTestFiles() {
    android::base::unique_fd fd(TEMP_FAILURE_RETRY(
            open(file1.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR)));
    if (fd != -1) {
        dprintf(fd, "content");
    } else {
        return false;
    }

    android::base::unique_fd fd2(TEMP_FAILURE_RETRY(
            open(file2.c_str(), O_WRONLY | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR)));
    if (fd2 != -1) {
        dprintf(fd2, "content");
    } else {
        return false;
    }
    return true;
}

void clearLocalHistoryTestFiles() {
    TEMP_FAILURE_RETRY(remove(file1.c_str()));
    TEMP_FAILURE_RETRY(remove(file2.c_str()));
    TEMP_FAILURE_RETRY(remove(file1_history.c_str()));
    TEMP_FAILURE_RETRY(remove(file2_history.c_str()));
}

bool fileExist(string name) {
    android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(name.c_str(), O_RDONLY | O_CLOEXEC)));
    return fd != -1;
}

/* The following AppendConfigReportTests test the 4 combinations of [whether erase data] [whether
 * the caller is adb] */
TEST(StorageManagerTest, AppendConfigReportTest1) {
    EXPECT_TRUE(prepareLocalHistoryTestFiles());

    ProtoOutputStream out;
    StorageManager::appendConfigMetricsReport(ConfigKey(1066, 1), &out, false /*erase?*/,
                                              false /*isAdb?*/);

    EXPECT_FALSE(fileExist(file1));
    EXPECT_FALSE(fileExist(file2));

    EXPECT_TRUE(fileExist(file1_history));
    EXPECT_TRUE(fileExist(file2_history));
    clearLocalHistoryTestFiles();
}

TEST(StorageManagerTest, AppendConfigReportTest2) {
    EXPECT_TRUE(prepareLocalHistoryTestFiles());

    ProtoOutputStream out;
    StorageManager::appendConfigMetricsReport(ConfigKey(1066, 1), &out, true /*erase?*/,
                                              false /*isAdb?*/);

    EXPECT_FALSE(fileExist(file1));
    EXPECT_FALSE(fileExist(file2));
    EXPECT_FALSE(fileExist(file1_history));
    EXPECT_FALSE(fileExist(file2_history));

    clearLocalHistoryTestFiles();
}

TEST(StorageManagerTest, AppendConfigReportTest3) {
    EXPECT_TRUE(prepareLocalHistoryTestFiles());

    ProtoOutputStream out;
    StorageManager::appendConfigMetricsReport(ConfigKey(1066, 1), &out, false /*erase?*/,
                                              true /*isAdb?*/);

    EXPECT_TRUE(fileExist(file1));
    EXPECT_TRUE(fileExist(file2));
    EXPECT_FALSE(fileExist(file1_history));
    EXPECT_FALSE(fileExist(file2_history));

    clearLocalHistoryTestFiles();
}

TEST(StorageManagerTest, AppendConfigReportTest4) {
    EXPECT_TRUE(prepareLocalHistoryTestFiles());

    ProtoOutputStream out;
    StorageManager::appendConfigMetricsReport(ConfigKey(1066, 1), &out, true /*erase?*/,
                                              true /*isAdb?*/);

    EXPECT_FALSE(fileExist(file1));
    EXPECT_FALSE(fileExist(file2));
    EXPECT_FALSE(fileExist(file1_history));
    EXPECT_FALSE(fileExist(file2_history));

    clearLocalHistoryTestFiles();
}

}  // namespace statsd
}  // namespace os
}  // namespace android
+0 −1
Original line number Diff line number Diff line
@@ -1105,7 +1105,6 @@ android.database.sqlite.SQLiteDatabase
android.database.sqlite.SQLiteDatabaseConfiguration
android.database.sqlite.SQLiteDatabaseCorruptException
android.database.sqlite.SQLiteDatabaseLockedException
android.database.sqlite.SQLiteDebug$Consts
android.database.sqlite.SQLiteDebug$DbStats
android.database.sqlite.SQLiteDebug$PagerStats
android.database.sqlite.SQLiteDebug
+1 −1
Original line number Diff line number Diff line
@@ -3681,7 +3681,7 @@ public class Activity extends ContextThemeWrapper
            ActivityTaskManager.getService().onBackPressedOnTaskRoot(mToken,
                    new IRequestFinishCallback.Stub() {
                        public void requestFinish() {
                            finishAfterTransition();
                            mHandler.post(() -> finishAfterTransition());
                        }
                    });
        } catch (RemoteException e) {
Loading