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 @@ + + + +