From 548c587a580ae6ff695f9ac2ed0280d8a6262ed1 Mon Sep 17 00:00:00 2001 From: Jonathan Ward Date: Tue, 2 Jul 2019 13:47:45 -0700 Subject: [PATCH] App that changes screen to multiple colors This app will be used to sync the timestamps for screen recording in Perfetto. Bug: 135278534 Test: Ran the app with the Perfetto trace and screenrecord Change-Id: I505fcb752a1e29455680ffd4a13c5803740c0b8f --- startop/apps/ColorChanging/.gitignore | 13 ++ .../apps/ColorChanging/.idea/encodings.xml | 4 + startop/apps/ColorChanging/.idea/gradle.xml | 15 ++ startop/apps/ColorChanging/.idea/misc.xml | 9 + .../ColorChanging/.idea/runConfigurations.xml | 12 ++ startop/apps/ColorChanging/README.md | 5 + startop/apps/ColorChanging/app/.gitignore | 1 + startop/apps/ColorChanging/app/build.gradle | 29 +++ .../apps/ColorChanging/app/proguard-rules.pro | 21 +++ .../ExampleInstrumentedTest.java | 27 +++ .../app/src/main/AndroidManifest.xml | 21 +++ .../startop/colorchanging/MainActivity.java | 91 +++++++++ .../drawable-v24/ic_launcher_foreground.xml | 34 ++++ .../res/drawable/ic_launcher_background.xml | 170 +++++++++++++++++ .../app/src/main/res/layout/activity_main.xml | 132 ++++++++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 2963 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 4905 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2060 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2783 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4490 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 6895 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6387 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10413 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9128 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15132 bytes .../app/src/main/res/values/colors.xml | 16 ++ .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 11 ++ .../colorchanging/ExampleUnitTest.java | 17 ++ startop/apps/ColorChanging/build.gradle | 24 +++ startop/apps/ColorChanging/gradle.properties | 20 ++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + startop/apps/ColorChanging/gradlew | 172 ++++++++++++++++++ startop/apps/ColorChanging/gradlew.bat | 84 +++++++++ startop/apps/ColorChanging/settings.gradle | 1 + 38 files changed, 948 insertions(+) create mode 100644 startop/apps/ColorChanging/.gitignore create mode 100644 startop/apps/ColorChanging/.idea/encodings.xml create mode 100644 startop/apps/ColorChanging/.idea/gradle.xml create mode 100644 startop/apps/ColorChanging/.idea/misc.xml create mode 100644 startop/apps/ColorChanging/.idea/runConfigurations.xml create mode 100644 startop/apps/ColorChanging/README.md create mode 100644 startop/apps/ColorChanging/app/.gitignore create mode 100644 startop/apps/ColorChanging/app/build.gradle create mode 100644 startop/apps/ColorChanging/app/proguard-rules.pro create mode 100644 startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java create mode 100644 startop/apps/ColorChanging/app/src/main/AndroidManifest.xml create mode 100644 startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java create mode 100644 startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 startop/apps/ColorChanging/app/src/main/res/values/colors.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/values/strings.xml create mode 100644 startop/apps/ColorChanging/app/src/main/res/values/styles.xml create mode 100644 startop/apps/ColorChanging/app/src/test/java/com/android/startop/colorchanging/ExampleUnitTest.java create mode 100644 startop/apps/ColorChanging/build.gradle create mode 100644 startop/apps/ColorChanging/gradle.properties create mode 100644 startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.jar create mode 100644 startop/apps/ColorChanging/gradle/wrapper/gradle-wrapper.properties create mode 100755 startop/apps/ColorChanging/gradlew create mode 100644 startop/apps/ColorChanging/gradlew.bat create mode 100644 startop/apps/ColorChanging/settings.gradle diff --git a/startop/apps/ColorChanging/.gitignore b/startop/apps/ColorChanging/.gitignore new file mode 100644 index 0000000000000..2b75303ac58f5 --- /dev/null +++ b/startop/apps/ColorChanging/.gitignore @@ -0,0 +1,13 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild diff --git a/startop/apps/ColorChanging/.idea/encodings.xml b/startop/apps/ColorChanging/.idea/encodings.xml new file mode 100644 index 0000000000000..15a15b218a29e --- /dev/null +++ b/startop/apps/ColorChanging/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/gradle.xml b/startop/apps/ColorChanging/.idea/gradle.xml new file mode 100644 index 0000000000000..2996d531255e0 --- /dev/null +++ b/startop/apps/ColorChanging/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/misc.xml b/startop/apps/ColorChanging/.idea/misc.xml new file mode 100644 index 0000000000000..37a750962da6f --- /dev/null +++ b/startop/apps/ColorChanging/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/startop/apps/ColorChanging/.idea/runConfigurations.xml b/startop/apps/ColorChanging/.idea/runConfigurations.xml new file mode 100644 index 0000000000000..7f68460d8b38a --- /dev/null +++ b/startop/apps/ColorChanging/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/startop/apps/ColorChanging/README.md b/startop/apps/ColorChanging/README.md new file mode 100644 index 0000000000000..eb8b9cc1103b0 --- /dev/null +++ b/startop/apps/ColorChanging/README.md @@ -0,0 +1,5 @@ +This directory contains a simple Android app that is meant to help in +syncing a trace along with a video in Perfetto. + +This app changes the colors of the screen that has traces to go along +with the colors. diff --git a/startop/apps/ColorChanging/app/.gitignore b/startop/apps/ColorChanging/app/.gitignore new file mode 100644 index 0000000000000..796b96d1c4023 --- /dev/null +++ b/startop/apps/ColorChanging/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/startop/apps/ColorChanging/app/build.gradle b/startop/apps/ColorChanging/app/build.gradle new file mode 100644 index 0000000000000..ab955aaf90eec --- /dev/null +++ b/startop/apps/ColorChanging/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.0" + defaultConfig { + applicationId "com.android.startop.colorchanging" + minSdkVersion 15 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' +} diff --git a/startop/apps/ColorChanging/app/proguard-rules.pro b/startop/apps/ColorChanging/app/proguard-rules.pro new file mode 100644 index 0000000000000..f1b424510da51 --- /dev/null +++ b/startop/apps/ColorChanging/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java b/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java new file mode 100644 index 0000000000000..31736f3e2862b --- /dev/null +++ b/startop/apps/ColorChanging/app/src/androidTest/java/com/android/startop/colorchanging/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.android.startop.colorchanging; + +import android.content.Context; + +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("com.android.startop.colorchanging", appContext.getPackageName()); + } +} diff --git a/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml b/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000..37193b5ff5962 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java b/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java new file mode 100644 index 0000000000000..b8f4faf299a9b --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/java/com/android/startop/colorchanging/MainActivity.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2019 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.startop.colorchanging; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.os.Trace; +import android.view.View; + +public class MainActivity extends AppCompatActivity { + View view; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + view = this.getWindow().getDecorView(); + view.setBackgroundResource(R.color.gray); + Trace.beginSection("gray"); + } + + public void goRed(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.red); + Trace.beginSection("red"); + } + + public void goOrange(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.orange); + Trace.beginSection("orange"); + } + + public void goYellow(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.yellow); + Trace.beginSection("yellow"); + } + + public void goGreen(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.green); + Trace.beginSection("green"); + } + + public void goBlue(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.blue); + Trace.beginSection("blue"); + } + + public void goIndigo(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.indigo); + Trace.beginSection("indigo"); + } + + public void goViolet(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.violet); + Trace.beginSection("violet"); + } + + public void goCyan(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.cyan); + Trace.beginSection("cyan"); + } + + public void goBlack(View v) { + Trace.endSection(); + view.setBackgroundResource(R.color.black); + Trace.beginSection("black"); + } + +} diff --git a/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000000..1f6bb290603d7 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml b/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000000..0d025f9bf6b67 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml b/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000..fb18df79cce27 --- /dev/null +++ b/startop/apps/ColorChanging/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,132 @@ + + + +