diff --git a/Labs/Lab3_DangerousApp/.gitignore b/Labs/Lab3_DangerousApp/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ceff37eff0e621e8f96607f26a6bced4727fb5a5 --- /dev/null +++ b/Labs/Lab3_DangerousApp/.gitignore @@ -0,0 +1,39 @@ +# built application files +*.apk +*.ap_ + +# files for the dex VM +*.dex + +# Java class files +*.class + +# generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Eclipse project files +.classpath +.settings + +# Proguard folder generated by Eclipse +proguard/ + +# Intellij project files +*.iml +*.ipr +*.iws +.idea +.idea/workspace.xml +.gradle +build/ +captures/ + +# Mac files +.DS_Store + +# Windows thumbnail db +Thumbs.db diff --git a/Labs/Lab3_DangerousApp/app/build.gradle b/Labs/Lab3_DangerousApp/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..50cd56294beb13256ad259c97fe147a17d119e48 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/build.gradle @@ -0,0 +1,28 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 31 + buildToolsVersion '31.0.0' + + defaultConfig { + applicationId "course.labs.dangerousapp" + minSdkVersion 26 + targetSdkVersion 31 + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } +} + +repositories { + mavenCentral() +} +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} \ No newline at end of file diff --git a/Labs/Lab3_DangerousApp/app/src/main/AndroidManifest.xml b/Labs/Lab3_DangerousApp/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..c561ecc6f42b45314584f7dde1c08a4ceffd992a --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="course.labs.dangerousapp" + android:versionCode="1" + android:versionName="1.0" > + + <!-- + TODO - Using a permission element, + define a custom permission with name + "course.labs.permissions.DANGEROUS_ACTIVITY_PERM" + and "dangerous" protection level. + --> + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + + <!-- TODO - enforce the custom permission on this Activity --> + + <activity + android:name=".DangerousActivity" + android:label="@string/app_name" + android:exported='true'> + + <!-- + TODO - add additional intent filter info so that this Activity + will respond to an Implicit Intent with the action + "course.labs.permissions.DANGEROUS_ACTIVITY" + --> + + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +</manifest> \ No newline at end of file diff --git a/Labs/Lab3_DangerousApp/app/src/main/java/course/labs/dangerousapp/DangerousActivity.kt b/Labs/Lab3_DangerousApp/app/src/main/java/course/labs/dangerousapp/DangerousActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..c33076125f9bf46b03feaa83a3286c3239425128 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/java/course/labs/dangerousapp/DangerousActivity.kt @@ -0,0 +1,13 @@ +package course.labs.dangerousapp + +import android.app.Activity +import android.os.Bundle + +class DangerousActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + } + +} diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..288b66551d1efd1f13dd06f20a67534d2df57946 Binary files /dev/null and b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..6ae570b4db4da165fada0650079061cb56aa8793 Binary files /dev/null and b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d4fb7cd9d868f1d7d9964f1686dcbc018ef9495a Binary files /dev/null and b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..85a6081587e2c2b9793d796ee7b07e12fdf860db Binary files /dev/null and b/Labs/Lab3_DangerousApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/layout/activity_main.xml b/Labs/Lab3_DangerousApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..efa0cef466a7768675e2a47bdafd85b31b5de1d6 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,16 @@ +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingBottom="@dimen/activity_vertical_margin" + android:paddingLeft="@dimen/activity_horizontal_margin" + android:paddingRight="@dimen/activity_horizontal_margin" + android:paddingTop="@dimen/activity_vertical_margin" + tools:context=".DangerousActivity" > + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/hello_world" /> + +</RelativeLayout> diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/values/dimens.xml b/Labs/Lab3_DangerousApp/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000000000000000000000000000000000000..55c1e5908c7e0f157fe815acd6d5cd7358463390 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/res/values/dimens.xml @@ -0,0 +1,7 @@ +<resources> + + <!-- Default screen margins, per the Android Design guidelines. --> + <dimen name="activity_horizontal_margin">16dp</dimen> + <dimen name="activity_vertical_margin">16dp</dimen> + +</resources> diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/values/strings.xml b/Labs/Lab3_DangerousApp/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..c811fbb995c38915c6a219ed0687fb8913aae7d6 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">DangerousApp</string> + <string name="hello_world">You have opened a dangerous activity</string> + +</resources> diff --git a/Labs/Lab3_DangerousApp/app/src/main/res/values/styles.xml b/Labs/Lab3_DangerousApp/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..6ce89c7ba4394d8cab27953d41456ce234ca37c3 --- /dev/null +++ b/Labs/Lab3_DangerousApp/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> diff --git a/Labs/Lab3_DangerousApp/build.gradle b/Labs/Lab3_DangerousApp/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..e7e2c3b5db30db2a3fccfbfd9740a977bcf25b3b --- /dev/null +++ b/Labs/Lab3_DangerousApp/build.gradle @@ -0,0 +1,18 @@ +buildscript { + ext.kotlin_version = '1.3.50' + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + google() + } +} diff --git a/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.jar b/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 Binary files /dev/null and b/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.properties b/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..026643a6d6dfdd8fcbf4978cc43b73226a7ea5e5 --- /dev/null +++ b/Labs/Lab3_DangerousApp/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Feb 16 18:18:06 EST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/Labs/Lab3_DangerousApp/gradlew b/Labs/Lab3_DangerousApp/gradlew new file mode 100644 index 0000000000000000000000000000000000000000..9d82f78915133e1c35a6ea51252590fb38efac2f --- /dev/null +++ b/Labs/Lab3_DangerousApp/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/Labs/Lab3_DangerousApp/gradlew.bat b/Labs/Lab3_DangerousApp/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..8a0b282aa6885fb573c106b3551f7275c5f17e8e --- /dev/null +++ b/Labs/Lab3_DangerousApp/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Labs/Lab3_DangerousApp/ic_launcher-web.png b/Labs/Lab3_DangerousApp/ic_launcher-web.png new file mode 100755 index 0000000000000000000000000000000000000000..a18cbb48c431dfcc163fce2b6e27e981f8c09f6a Binary files /dev/null and b/Labs/Lab3_DangerousApp/ic_launcher-web.png differ diff --git a/Labs/Lab3_DangerousApp/import-summary.txt b/Labs/Lab3_DangerousApp/import-summary.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3b5f5d0899ee5b08253e3dee48d26960bf00fb6 --- /dev/null +++ b/Labs/Lab3_DangerousApp/import-summary.txt @@ -0,0 +1,75 @@ +ECLIPSE ANDROID PROJECT IMPORT SUMMARY +====================================== + +Ignored Files: +-------------- +The following files were *not* copied into the new Gradle project; you +should evaluate whether these are still needed in your project and if +so manually move them: + +* .gitignore +* .idea\ +* .idea\compiler.xml +* .idea\copyright\ +* .idea\copyright\profiles_settings.xml +* .idea\misc.xml +* .idea\workspace.xml +* app\ +* app\build.gradle +* app\src\ +* app\src\main\ +* app\src\main\AndroidManifest.xml +* app\src\main\java\ +* app\src\main\java\course\ +* app\src\main\java\course\labs\ +* app\src\main\java\course\labs\dangerousapp\ +* app\src\main\java\course\labs\dangerousapp\DangerousActivity.java +* app\src\main\res\ +* app\src\main\res\drawable-hdpi\ +* app\src\main\res\drawable-hdpi\ic_launcher.png +* app\src\main\res\drawable-mdpi\ +* app\src\main\res\drawable-mdpi\ic_launcher.png +* app\src\main\res\drawable-xhdpi\ +* app\src\main\res\drawable-xhdpi\ic_launcher.png +* app\src\main\res\drawable-xxhdpi\ +* app\src\main\res\drawable-xxhdpi\ic_launcher.png +* app\src\main\res\layout\ +* app\src\main\res\layout\activity_main.xml +* app\src\main\res\values\ +* app\src\main\res\values\dimens.xml +* app\src\main\res\values\strings.xml +* app\src\main\res\values\styles.xml +* build.gradle +* gradle\ +* gradle\wrapper\ +* gradle\wrapper\gradle-wrapper.jar +* gradle\wrapper\gradle-wrapper.properties +* gradlew +* gradlew.bat +* ic_launcher-web.png +* proguard-project.txt +* settings.gradle + +Moved Files: +------------ +Android Gradle projects use a different directory structure than ADT +Eclipse projects. Here's how the projects were restructured: + +* AndroidManifest.xml => app\src\main\AndroidManifest.xml +* res\ => app\src\main\res\ +* src\ => app\src\main\java\ + +Next Steps: +----------- +You can now build the project. The Gradle project needs network +connectivity to download dependencies. + +Bugs: +----- +If for some reason your project does not build, and you determine that +it is due to a bug or limitation of the Eclipse to Gradle importer, +please file a bug at http://b.android.com with category +Component-Tools. + +(This import summary is for your information only, and can be deleted +after import once you are satisfied with the results.) diff --git a/Labs/Lab3_DangerousApp/proguard-project.txt b/Labs/Lab3_DangerousApp/proguard-project.txt new file mode 100755 index 0000000000000000000000000000000000000000..f2fe1559a217865a5454add526dcc446f892385b --- /dev/null +++ b/Labs/Lab3_DangerousApp/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# 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 *; +#} diff --git a/Labs/Lab3_DangerousApp/project.properties b/Labs/Lab3_DangerousApp/project.properties new file mode 100755 index 0000000000000000000000000000000000000000..ce39f2d0a061116c8dfd41e74b2bfd54ff4d554b --- /dev/null +++ b/Labs/Lab3_DangerousApp/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-18 diff --git a/Labs/Lab3_DangerousApp/settings.gradle b/Labs/Lab3_DangerousApp/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..e7b4def49cb53d9aa04228dd3edb14c9e635e003 --- /dev/null +++ b/Labs/Lab3_DangerousApp/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000000000000000000000000000000000000..f75143a8bca2c4f5044dbb4bd9016cbd837ecc97 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.lock b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..3f5e82a8e2792237c2402f207942292f136c858a Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/executionHistory/executionHistory.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileChanges/last-build.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileChanges/last-build.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileContent/fileContent.lock b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileContent/fileContent.lock new file mode 100644 index 0000000000000000000000000000000000000000..349225aa514baccbfeb0be7f90330bd069f7a7cc Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileContent/fileContent.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000000000000000000000000000000000000..d90b0b0f9bfbd31e5f524e2cd23fc36788073e94 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.lock b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000000000000000000000000000000000000..b479921d0d3c3ee9ff6e1f371f7d45377ea3fd3e Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/fileHashes.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/resourceHashesCache.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000000000000000000000000000000000000..2f60d52c31c9315a640f16e43ddb0e2cb791a369 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/fileHashes/resourceHashesCache.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/gc.properties b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/gc.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/classAnalysis.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/classAnalysis.bin new file mode 100644 index 0000000000000000000000000000000000000000..6d5537afa5e98259f3d4fff0220ae854b52aba8b Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/classAnalysis.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/jarAnalysis.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/jarAnalysis.bin new file mode 100644 index 0000000000000000000000000000000000000000..5f0389e09320dd6aa45393cabdc50cd0d224fecc Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/jarAnalysis.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/javaCompile.lock b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/javaCompile.lock new file mode 100644 index 0000000000000000000000000000000000000000..439d699b0f0650d7313301fe14bb4f8a92566e20 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/javaCompile.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/taskHistory.bin b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/taskHistory.bin new file mode 100644 index 0000000000000000000000000000000000000000..fe483c5762c369286a4b160ce597af935ff2c77e Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/5.4.1/javaCompile/taskHistory.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock b/Labs/Lab3_DatamanagementLab/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000000000000000000000000000000000000..146d23fedf59d3ebe554aaa3f0eb1cd8ee067558 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/dependencies-accessors/gc.properties b/Labs/Lab3_DatamanagementLab/.gradle/7.2/dependencies-accessors/gc.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.bin b/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.bin new file mode 100644 index 0000000000000000000000000000000000000000..c8aa75d526aff7e7438c3a030f39399e31dc2515 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.lock b/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..836148d8401736db884b55a49e8e35aa0c6f712b Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/executionHistory/executionHistory.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileChanges/last-build.bin b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileChanges/last-build.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.bin b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.bin new file mode 100644 index 0000000000000000000000000000000000000000..5cff811bbd4c63587dc71bc03dfe61d23907e011 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.lock b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.lock new file mode 100644 index 0000000000000000000000000000000000000000..b1e2407fe087c1a59542adb8cd2f4e00976d637b Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/fileHashes.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/resourceHashesCache.bin b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000000000000000000000000000000000000..184a703a4b51925e4dd0c7c2e0b2f6bda8487506 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/7.2/fileHashes/resourceHashesCache.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/7.2/gc.properties b/Labs/Lab3_DatamanagementLab/.gradle/7.2/gc.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000000000000000000000000000000000000..43a6a205ab9e91fc95fd6e4c0153b488a552d8de Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/cache.properties b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000000000000000000000000000000000000..bad518c25173413f4b977f231946693f706e0bf3 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Tue Feb 15 03:51:55 EST 2022 +gradle.version=7.2 diff --git a/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/outputFiles.bin b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000000000000000000000000000000000000..dddc48ef418b474375b8d5255edf25a199f704a0 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/checksums/checksums.lock b/Labs/Lab3_DatamanagementLab/.gradle/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..7c3e9e6d0ac2e5e259e53043d43f2cd43a4b8990 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/checksums/checksums.lock differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/checksums/md5-checksums.bin b/Labs/Lab3_DatamanagementLab/.gradle/checksums/md5-checksums.bin new file mode 100644 index 0000000000000000000000000000000000000000..069e315d5d64b8fdc74a7af2842428e9c22346a7 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/checksums/md5-checksums.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/checksums/sha1-checksums.bin b/Labs/Lab3_DatamanagementLab/.gradle/checksums/sha1-checksums.bin new file mode 100644 index 0000000000000000000000000000000000000000..030808bbd501ac0cd868a6bee56dc2abfab55df6 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/.gradle/checksums/sha1-checksums.bin differ diff --git a/Labs/Lab3_DatamanagementLab/.gradle/vcs-1/gc.properties b/Labs/Lab3_DatamanagementLab/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Labs/Lab3_DatamanagementLab/DataManagement Lab.webm b/Labs/Lab3_DatamanagementLab/DataManagement Lab.webm new file mode 100644 index 0000000000000000000000000000000000000000..a32c5d31b937989202b9687f237c5849c3eaddd0 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/DataManagement Lab.webm differ diff --git a/Labs/Lab3_DatamanagementLab/DataManagementLab.docx b/Labs/Lab3_DatamanagementLab/DataManagementLab.docx new file mode 100644 index 0000000000000000000000000000000000000000..21a655c7315f450b3440b5b3f8a003b0abaf51d1 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/DataManagementLab.docx differ diff --git a/Labs/Lab3_DatamanagementLab/DataManagementLab.mp4 b/Labs/Lab3_DatamanagementLab/DataManagementLab.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..fbfe84756b924872ae32cf78868d7cd0f265803b Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/DataManagementLab.mp4 differ diff --git a/Labs/Lab3_DatamanagementLab/DataManagementLab.pdf b/Labs/Lab3_DatamanagementLab/DataManagementLab.pdf new file mode 100644 index 0000000000000000000000000000000000000000..97d5c8acc0c817dd2c312216dafd9dee8a216622 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/DataManagementLab.pdf differ diff --git a/Labs/Lab3_DatamanagementLab/app/.gitignore b/Labs/Lab3_DatamanagementLab/app/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..796b96d1c402326528b4ba3c12ee9d92d0e212e9 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/Labs/Lab3_DatamanagementLab/app/app.iml b/Labs/Lab3_DatamanagementLab/app/app.iml new file mode 100644 index 0000000000000000000000000000000000000000..51e6b3091dadd33a8ba55438f07c4ccec6010268 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/app.iml @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="testapp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="android-gradle" name="Android-Gradle"> + <configuration> + <option name="GRADLE_PROJECT_PATH" value=":app" /> + <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.0" /> + <option name="LAST_KNOWN_AGP_VERSION" value="3.5.0" /> + </configuration> + </facet> + <facet type="android" name="Android"> + <configuration> + <option name="SELECTED_BUILD_VARIANT" value="debug" /> + <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> + <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> + <afterSyncTasks> + <task>generateDebugSources</task> + </afterSyncTasks> + <option name="ALLOW_USER_CONFIGURATION" value="false" /> + <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" /> + <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> + <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/src/debug/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" /> + <option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/androidTest/res;file://$MODULE_DIR$/src/test/res;file://$MODULE_DIR$/src/androidTestDebug/res;file://$MODULE_DIR$/src/testDebug/res;file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug;file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" /> + <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> + </configuration> + </facet> + <facet type="kotlin-language" name="Kotlin"> + <configuration version="3" platform="JVM 1.6" allPlatforms="JVM [1.6]" useProjectSettings="false"> + <compilerSettings> + <option name="additionalArguments" value="-Xallow-no-source-files" /> + </compilerSettings> + <compilerArguments> + <option name="destination" value="$MODULE_DIR$/build/tmp/kotlin-classes/debug" /> + <option name="classpath" value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.50/50ad05ea1c2595fb31b800e76db464d08d599af3/kotlin-stdlib-jdk7-1.3.50.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/e9e28303271675cf1ee0fa098d9bf192/core-ktx-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/b529d1738c7e98bbfa36a4134039528f2ce78ebf/kotlin-stdlib-1.3.50.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.50/3d9cd3e1bc7b92e95f43d45be3bfbcf38e36ab87/kotlin-stdlib-common-1.3.50.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/5ea0b29cb75204746db73749dcd594c6/appcompat-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/44cacdc61fa6eecf1a8011a3537dd3cb/lifecycle-extensions-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/c4f1ba644f7fb2a4127efbe45e461ebb/fragment-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/b4298bb4537874cbc59d2654e95f80d4/appcompat-resources-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/0e7c68274fb8b28cc0414eb5b896e448/drawerlayout-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/af36f58cd0e158191b16f152cd9384fa/viewpager-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/6584f13befaca8ea228d4715e2dc3ad7/loader-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/febe59ff1da8753dbabd294b938bff61/activity-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/8859cba3dd8085149d8fad52d2881a71/vectordrawable-animated-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/b334d927c7826de0bdd4284376c0771a/vectordrawable-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/03a5f07200efd577bbc8803fd8b08cb6/customview-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/9c933b15d9f93e76e4d82ea7601e25c9/core-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/9cba381e8055641c4dc40bc11abe10f8/cursoradapter-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/67c883568d1fe6725642d1cded7759e4/versionedparcelable-1.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/1f27220b47669781457de0d600849a5de0e89909/collection-1.1.0.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/b152b3c04d3a695c87d2a265ecb4f689/lifecycle-process-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/85ebf1209c689f3700b8dc695cede914/lifecycle-service-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/e123e7d4f1d0b6afe261626cf9ae11a4/lifecycle-runtime-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/da4044bb6cba89b6e8f12a7f5ff1d2a5/lifecycle-livedata-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/e66836122a6182851d6d5fea9a92d9d9/lifecycle-livedata-core-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/6fcbd956a7ac4ccbcd3f99e371f2f5e9/core-runtime-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/c3b4bf8dfe519e5220646fb71f2fce27/savedstate-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/b3152fc64428c9354344bd89848ecddc09b6f07e/core-common-2.1.0.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.1.0/c67e7807d9cd6c329b9d0218b2ec4e505dd340b7/lifecycle-common-2.1.0.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/46cfcc498f2d2fa4502abe721b554702/lifecycle-viewmodel-2.1.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/2d0d7c2d9455c2e14c5e442172548106/interpolator-1.0.0/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.1.0/e3a6fb2f40e3a3842e6b7472628ba4ce416ea4c8/annotation-1.1.0.jar;C:/Users/Shoumit Karnik/.gradle/caches/transforms-2/files-2.1/6102808b9ba7d8939166ec116dd388e7/constraintlayout-1.1.3/jars/classes.jar;C:/Users/Shoumit Karnik/.gradle/caches/modules-2/files-2.1/androidx.constraintlayout/constraintlayout-solver/1.1.3/54abe9ffb22cc9019b0b6fcc10f185cc4e67b34e/constraintlayout-solver-1.1.3.jar;C:/Users/Shoumit Karnik/AppData/Local/Android/Sdk/platforms/android-28/android.jar" /> + <option name="noStdlib" value="true" /> + <option name="noReflect" value="true" /> + <option name="moduleName" value="app_debug" /> + <option name="languageVersion" value="1.3" /> + <option name="apiVersion" value="1.3" /> + <option name="pluginOptions"> + <array> + <option value="plugin:org.jetbrains.kotlin.android:experimental=false" /> + <option value="plugin:org.jetbrains.kotlin.android:enabled=true" /> + <option value="plugin:org.jetbrains.kotlin.android:defaultCacheImplementation=hashMap" /> + </array> + </option> + <option name="pluginClasspaths"> + <array> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.intellij.deps/trove4j/1.0.20181211/216c2e14b070f334479d800987affe4054cd563f/trove4j-1.0.20181211.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-android-extensions/1.3.50/f16428b9ce307d0f5842bd8ed9af1e43a141edd3/kotlin-android-extensions-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.50/1251c1768e5769b06c2487d6f6cf8acf6efb8960/kotlin-compiler-embeddable-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-daemon-embeddable/1.3.50/5cb93bb33f4c6f833ead0beca4c831668e00cf52/kotlin-daemon-embeddable-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.50/b499f22fd7c3e9c2e5b6c4005221fa47fc7f9a7a/kotlin-reflect-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.50/59492b8dfb92522ba0ddb5dd1c4d0ef0a4fca1af/kotlin-script-runtime-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.50/3d9cd3e1bc7b92e95f43d45be3bfbcf38e36ab87/kotlin-stdlib-common-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/b529d1738c7e98bbfa36a4134039528f2ce78ebf/kotlin-stdlib-1.3.50.jar" /> + <option value="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar" /> + </array> + </option> + <option name="errors"> + <ArgumentParseErrors /> + </option> + </compilerArguments> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7"> + <output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" /> + <output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" /> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> + <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/build" /> + </content> + <orderEntry type="jdk" jdkName="Android API 28 Platform" jdkType="Android SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.mockito:mockito-android:2.24.5@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: junit:junit:4.12@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-integration:1.3@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-library:1.3@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.hamcrest:hamcrest-core:1.3@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: net.sf.kxml:kxml2:2.3.0@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: com.squareup:javawriter:2.1.1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: javax.inject:javax.inject:1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: com.google.code.findbugs:jsr305:2.0.1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.mockito:mockito-core:2.24.5@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: net.bytebuddy:byte-buddy-android:1.9.7@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: net.bytebuddy:byte-buddy:1.9.7@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: net.bytebuddy:byte-buddy-agent:1.9.7@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: org.objenesis:objenesis:2.6@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: com.jakewharton.android.repackaged:dalvik-dx:1@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: com.jakewharton.android.repackaged:libcore-dex:2@jar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-core:3.2.0@aar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:rules:1.1.0@aar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:runner:1.2.0@aar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: androidx.test:monitor:1.2.0@aar" level="project" /> + <orderEntry type="library" scope="TEST" name="Gradle: androidx.test.espresso:espresso-idling-resource:3.2.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50@jar" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.50@jar" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50@jar" level="project" /> + <orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.1.0@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.1.0@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout-solver:1.1.3@jar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.core:core-ktx:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-extensions:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.activity:activity:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.core:core:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-process:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-service:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.1.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" /> + <orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" /> + </component> +</module> \ No newline at end of file diff --git a/Labs/Lab3_DatamanagementLab/app/build.gradle b/Labs/Lab3_DatamanagementLab/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..6f904462ceaa0a09a7aa5375e26c6e83f6a60da3 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/build.gradle @@ -0,0 +1,43 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android-extensions' +apply plugin: 'kotlin-android' + +android { + compileSdkVersion 31 + defaultConfig { + applicationId "com.example.test_storageapp" + minSdkVersion 26 + targetSdkVersion 31 + versionCode 1 + versionName "1.0" + testInstrumentationRunnerArguments clearPackageData: 'true' + 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.1.0' + implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0' + androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.0' + androidTestImplementation 'androidx.test:rules:1.4.1-alpha03' + androidTestImplementation 'androidx.test:rules:1.4.1-alpha03' + androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' + implementation 'androidx.annotation:annotation:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha03' + +} +repositories { + mavenCentral() +} diff --git a/Labs/Lab3_DatamanagementLab/app/proguard-rules.pro b/Labs/Lab3_DatamanagementLab/app/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..f1b424510da51fd82143bc74a0a801ae5a1e2fcd --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/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/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExampleInstrumentedTest.kt b/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExampleInstrumentedTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..8511efbd7dcf4d4540b3394e90af7348fd866f95 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExampleInstrumentedTest.kt @@ -0,0 +1,95 @@ +package com.example.test_storageapp + +import android.content.Context +import android.content.pm.ActivityInfo +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.ViewAction +import androidx.test.espresso.action.ViewActions.* +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.* +import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation +import org.junit.Before +import org.junit.Rule +//import junit.framework.Assert; +import org.junit.Assert.assertEquals +import org.junit.Assert; +import androidx.test.rule.ActivityTestRule +import androidx.test.runner.AndroidJUnit4 +import org.junit.Test +import org.junit.runner.RunWith +import android.content.SharedPreferences +import android.widget.EditText +import android.widget.TextView + +import org.junit.After + + +/** + * Instrumented test, which will execute on an Android device. + * + * @see [Testing documentation](http://d.android.com/tools/testing) + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Rule + @JvmField + var activityTestRule = ActivityTestRule(MainActivity::class.java) + + private val PREFS_NAME = "mypref" + private val KEY_PREF = "nameKey" + private var sharedPreferences: SharedPreferences? = null + + @Before + fun before() { + val context = getInstrumentation().getTargetContext() + sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) + } + + +// @After +// fun after() { +// sharedPreferences!!.edit().putString(KEY_PREF, null).apply() +// } + + @Test + fun acheckNameUID() { + onView(withId(R.id.etName)).perform(clearText(), typeText("Test Name")); + onView(withId(R.id.etUid)).perform(clearText(), typeText("1234568")); + onView(withId(R.id.btnSave)).perform(click()) + Thread.sleep(2000) + val targetContext = getInstrumentation().targetContext + + val context = getInstrumentation().getTargetContext() + sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) + val string2 = sharedPreferences!!.getString("nameKey", "") + assertEquals("Test Name", string2) + val string3 = sharedPreferences!!.getString("uidkey", "") + assertEquals("1234568", string3) + } + + @Test + fun bcheckClear() { + onView(withId(R.id.btnClear)).perform(click()) + Thread.sleep(2000) + val textView: TextView = activityTestRule.activity.findViewById(R.id.etName) + assertEquals(textView.text.toString(), "") + val textView2: TextView = activityTestRule.activity.findViewById(R.id.etUid) + assertEquals(textView2.text.toString(), "") + } + + @Test + fun ccheckEditText() { + onView(withId(R.id.btnRetr)).perform(click()) + Thread.sleep(2000) + val textView: TextView = activityTestRule.activity.findViewById(R.id.etName) + assertEquals(textView.text.toString(), "Test Name") + val textView2: TextView = activityTestRule.activity.findViewById(R.id.etUid) + assertEquals(textView2.text.toString(), "1234568") + + } + + + + + +} diff --git a/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExternalTest.kt b/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExternalTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..3893c897ce5c694ddaf0898cb44aa3ff5a0626b4 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/androidTest/java/com/example/test_storageapp/ExternalTest.kt @@ -0,0 +1,78 @@ +package com.example.test_storageapp + +import org.junit.Assert.* +import android.content.Context +import android.content.pm.ActivityInfo +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.ViewAction +import androidx.test.espresso.action.ViewActions.* +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.* +import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation +import org.junit.Before +import org.junit.Rule +//import junit.framework.Assert; +import org.junit.Assert.assertEquals +import org.junit.Assert; +import androidx.test.rule.ActivityTestRule +import androidx.test.runner.AndroidJUnit4 +import org.junit.Test +import org.junit.runner.RunWith +import android.content.SharedPreferences +import android.widget.EditText +import android.widget.TextView +import org.junit.After +import java.io.File + + +/** + * Instrumented test, which will execute on an Android device. + * + * @see [Testing documentation](http://d.android.com/tools/testing) + */ +@RunWith(AndroidJUnit4::class) +class ExternalTest { + @Rule + @JvmField + var activityTestRule = ActivityTestRule(External::class.java) + + private val PREFS_NAME = "mypref" + private val KEY_PREF = "nameKey" + private var sharedPreferences: SharedPreferences? = null + + @Before + fun before() { + val context = getInstrumentation().getTargetContext() + sharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE) + } + + + + @Test + fun checkNameUID() { +// onView(withId(R.id.button2)).perform(click()) + lateinit var myExternalFile: File + val context = getInstrumentation().getTargetContext() + val filename = "SampleFile.txt" + val filepath = "MyFileStorage" + onView(withId(R.id.myInputText)).perform(clearText(), typeText("Test Name")); + myExternalFile = File(context.getExternalFilesDir(filepath), filename) + onView(withId(R.id.saveExternalStorage)).perform(click()) + val targetContext = getInstrumentation().targetContext + val str = myExternalFile.readText() + assertEquals(str, "Test Name") + + } + + @Test + fun checkRetrieve() { +// onView(withId(R.id.button2)).perform(click()) + onView(withId(R.id.getExternalStorage)).perform(click()) +// Thread.sleep(5000) + val textView: TextView = activityTestRule.activity.findViewById(R.id.myInputText) + assertEquals(textView.text.toString(), "Test Name") + + } + + +} diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/AndroidManifest.xml b/Labs/Lab3_DatamanagementLab/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..06a8b1c792099256e49eaa031ade500e137fe14e --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.test_storageapp"> + + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + <activity + android:name=".External" + android:exported="true"></activity> + <activity + android:name=".MainActivity" + android:exported="true"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> + +<!-- TODO : Define permissions for reading and writing to external storage--> + +</manifest> \ No newline at end of file diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/External.kt b/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/External.kt new file mode 100644 index 0000000000000000000000000000000000000000..c785a5ab609198fd46a37123c411af2f409db339 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/External.kt @@ -0,0 +1,113 @@ +package com.example.test_storageapp + +import android.view.View.OnClickListener +import androidx.appcompat.app.AppCompatActivity + +import android.os.Bundle +import android.os.Environment +import android.util.Log +import android.view.View +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import java.io.* + +class External : AppCompatActivity() { + protected lateinit var inputText: EditText + protected lateinit var response: TextView + protected lateinit var saveButton: Button + protected lateinit var readButton: Button + + private val filename = "SampleFile.txt" + private val filepath = "MyFileStorage" + protected lateinit var myExternalFile: File + internal var myData = "" + private val isExternalStorageReadOnly: Boolean + get() { + val extStorageState = Environment.getExternalStorageState() + return if (Environment.MEDIA_MOUNTED_READ_ONLY == extStorageState) { + true + } else false + } + + private val isExternalStorageAvailable: Boolean + get() { + val extStorageState = Environment.getExternalStorageState() + return if (Environment.MEDIA_MOUNTED == extStorageState) { + true + } else false + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_external) + + + // TODO: Assign the following values from the resources + // inputText = + // response = + // saveButton = + // readButton = + + + saveButton.setOnClickListener { + //Do the following when save button is clicked + + + var fos: FileWriter? = null + try { + // TODO: Write the input text to external storage using fos file handler + + } catch (e: IOException) { + e.printStackTrace() + } + finally { + if (fos != null) { + try { + fos.close() + } catch (e: IOException) { + e.printStackTrace() + Log.e("errr","not close") + } + + } + } + + //TODO: Set response and reset input text + + } + + + + + readButton.setOnClickListener { + + try { + + // TODO: Read from saved location into myData + + } + + catch (e: IOException) { + e.printStackTrace() + } + + // TODO: Set input text and response text + + } + + + if (!isExternalStorageAvailable || isExternalStorageReadOnly) { + saveButton.isEnabled = false + } else { + myExternalFile = File(getExternalFilesDir(filepath), filename) + } + + + } +} + + + + + diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/MainActivity.kt b/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/MainActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..ee50b74ebf480a68b7fc4a6c378fa2408c1326d9 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/java/com/example/test_storageapp/MainActivity.kt @@ -0,0 +1,83 @@ +package com.example.test_storageapp + +import androidx.appcompat.app.AppCompatActivity + +import android.content.Context +import android.content.Intent +import android.content.SharedPreferences +import android.os.Bundle +import android.view.Menu +import android.view.View +import android.widget.TextView +import androidx.core.content.ContextCompat.startActivity +//import javax.swing.text.View + +class MainActivity : AppCompatActivity() { + + protected lateinit var sharedpreferences: SharedPreferences + protected lateinit var name: TextView + protected lateinit var uidtv: TextView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val view : View? = null + Get(view) + + } + + fun Save(view: View) { + //TODO: Save name and uidtv to sharedpreference + +// val n = name.text.toString() +// val e = uidtv.text.toString() +// val editor = sharedpreferences.edit() +// editor.putString(Name, n) +// editor.putString(uid, e) +// editor.commit() + } + + fun clear(view: View) { + //TODO: Reset name and uidtv + + +// name = findViewById<View>(R.id.etName) as TextView +// uidtv = findViewById<View>(R.id.etUid) as TextView +// name.text = "" +// uidtv.text = "" + + } + + fun Get(view: View?) { + //TODO: Get name, shared preferences and uidtv + +// name = findViewById<View>(R.id.etName) as TextView +// uidtv = findViewById<View>(R.id.etUid) as TextView +// sharedpreferences = getSharedPreferences(mypreference, +// Context.MODE_PRIVATE) +// +// if (sharedpreferences.contains(Name)) { +// name.text = sharedpreferences.getString(Name, "") +// } +// if (sharedpreferences.contains(uid)) { +// uidtv.text = sharedpreferences.getString(uid, "") +// +// } + + + } + + fun goToAnActivity(view: View) { + //TODO: Start External activity using intent + +// val intent = Intent(this, External::class.java) +// startActivity(intent) + } + + companion object { + val mypreference = "mypref" + val Name = "nameKey" + val uid = "uidkey" + } +} diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000000000000000000000000000000000000..1f6bb290603d7caa16c5fb6f61bbfdc750622f5c --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:aapt="http://schemas.android.com/aapt" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillType="evenOdd" + android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z" + android:strokeWidth="1" + android:strokeColor="#00000000"> + <aapt:attr name="android:fillColor"> + <gradient + android:endX="78.5885" + android:endY="90.9159" + android:startX="48.7653" + android:startY="61.0927" + android:type="linear"> + <item + android:color="#44000000" + android:offset="0.0" /> + <item + android:color="#00000000" + android:offset="1.0" /> + </gradient> + </aapt:attr> + </path> + <path + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z" + android:strokeWidth="1" + android:strokeColor="#00000000" /> +</vector> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable/ic_launcher_background.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000000000000000000000000000000000000..0d025f9bf6b67c63044a36a9ff44fbc69e5c5822 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="108dp" + android:height="108dp" + android:viewportWidth="108" + android:viewportHeight="108"> + <path + android:fillColor="#008577" + android:pathData="M0,0h108v108h-108z" /> + <path + android:fillColor="#00000000" + android:pathData="M9,0L9,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,0L19,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,0L29,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,0L39,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,0L49,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,0L59,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,0L69,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,0L79,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M89,0L89,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M99,0L99,108" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,9L108,9" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,19L108,19" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,29L108,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,39L108,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,49L108,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,59L108,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,69L108,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,79L108,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,89L108,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M0,99L108,99" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,29L89,29" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,39L89,39" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,49L89,49" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,59L89,59" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,69L89,69" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M19,79L89,79" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M29,19L29,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M39,19L39,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M49,19L49,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M59,19L59,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M69,19L69,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> + <path + android:fillColor="#00000000" + android:pathData="M79,19L79,89" + android:strokeWidth="0.8" + android:strokeColor="#33FFFFFF" /> +</vector> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_external.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_external.xml new file mode 100644 index 0000000000000000000000000000000000000000..42d7f401b18575a2a1d02e8626f3215f83b902d2 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_external.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +xmlns:tools="http://schemas.android.com/tools" +android:layout_width="fill_parent" android:layout_height="fill_parent" +android:orientation="vertical" +tools:context=".External"> + +<TextView android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Reading and Writing to External Storage" + android:textSize="24sp"/> + +<EditText android:id="@+id/myInputText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" android:lines="5" + android:minLines="3" android:gravity="top|left" + android:inputType="textMultiLine"> + + <requestFocus /> +</EditText> + +<LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" + android:orientation="horizontal" + android:weightSum="1.0" + android:layout_marginTop="20dp"> + + <Button android:id="@+id/saveExternalStorage" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="SAVE" + android:layout_weight="0.5"/> + + <Button android:id="@+id/getExternalStorage" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="0.5" + android:text="READ" /> + +</LinearLayout> + +<TextView android:id="@+id/response" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:padding="5dp" + android:text="" + android:textAppearance="?android:attr/textAppearanceMedium" /> + +</LinearLayout> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_main.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000000000000000000000000000000000000..c399d687496969abbb1141e3a56a53d9d673cdd5 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,73 @@ + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:paddingBottom="20dp" + android:paddingLeft="20dp" + android:paddingRight="20dp" + android:paddingTop="150dp" > + + <Button + android:id="@+id/btnSave" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerVertical="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:onClick="Save" + android:text="Save" /> + + <Button + android:id="@+id/btnRetr" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:onClick="Get" + android:text="Retrieve" /> + + <Button + android:id="@+id/btnClear" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignRight="@+id/etUid" + android:layout_centerVertical="true" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:onClick="clear" + android:text="Clear" /> + + <EditText + android:id="@+id/etUid" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="UID" + android:inputType="textEmailAddress" + android:layout_below="@+id/etName" + android:layout_marginTop="20dp" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + + <EditText + android:id="@+id/etName" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:hint="Name" + android:inputType="text" + android:layout_alignParentTop="true" + android:layout_alignLeft="@+id/etUid" + android:layout_alignStart="@+id/etUid" /> + + <Button + android:id="@+id/button2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/btnClear" + android:layout_marginTop="40dp" + android:onClick="goToAnActivity" + android:layout_alignParentRight="true" + android:text="External Storage" /> + +</RelativeLayout> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000000000000000000000000000000000000..eca70cfe52eac1ba66ba280a68ca7be8fcf88a16 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> + <background android:drawable="@drawable/ic_launcher_background" /> + <foreground android:drawable="@drawable/ic_launcher_foreground" /> +</adaptive-icon> \ No newline at end of file diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..898f3ed59ac9f3248734a00e5902736c9367d455 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..dffca3601eba7bf5f409bdd520820e2eb5122c75 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..64ba76f75e9ce021aa3d95c213491f73bcacb597 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..dae5e082342fcdeee5db8a6e0b27028e2d2808f5 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..e5ed46597ea8447d91ab1786a34e30f1c26b18bd Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..14ed0af35023e4f1901cf03487b6c524257b8483 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..b0907cac3bfd8fbfdc46e1108247f0a1055387ec Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..d8ae03154975f397f8ed1b84f2d4bf9783ecfa26 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..2c18de9e66108411737e910f5c1972476f03ddbf Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000000000000000000000000000000000000..beed3cdd2c32af5114a7dc70b9ef5b698eb8797e Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/values/colors.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/colors.xml new file mode 100644 index 0000000000000000000000000000000000000000..69b22338c6510250df3b43672635120dbce2fa49 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="colorPrimary">#008577</color> + <color name="colorPrimaryDark">#00574B</color> + <color name="colorAccent">#D81B60</color> +</resources> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/values/strings.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..1af0d3ceeb879a93170de4d4cd4472ee97885594 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ +<resources> + <string name="app_name">DataManagement Lab</string> + <string name="namestring"> Name</string> + <string name="uid"> UID</string> +</resources> diff --git a/Labs/Lab3_DatamanagementLab/app/src/main/res/values/styles.xml b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..5885930df6d10edf3d6df40d6556297d11f953da --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/app/src/main/res/values/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- Base application theme. --> + <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> + <!-- Customize your theme here. --> + <item name="colorPrimary">@color/colorPrimary</item> + <item name="colorPrimaryDark">@color/colorPrimaryDark</item> + <item name="colorAccent">@color/colorAccent</item> + </style> + +</resources> diff --git a/Labs/Lab3_DatamanagementLab/build.gradle b/Labs/Lab3_DatamanagementLab/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..9dfc881c5d03adee35f45676cabac0b8ed31af5f --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/build.gradle @@ -0,0 +1,24 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + google() + } +} + + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/Labs/Lab3_DatamanagementLab/gradle.properties b/Labs/Lab3_DatamanagementLab/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..199d16ede38cfde6d8ff5c75d5d04785ae8c504d --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/gradle.properties @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + diff --git a/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.jar b/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..f6b961fd5a86aa5fbfe90f707c3138408be7c718 Binary files /dev/null and b/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.properties b/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..c8f3ca2cc9bcec3837051b2c8a84bf30c76f85b9 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Feb 15 03:51:51 EST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/Labs/Lab3_DatamanagementLab/gradlew b/Labs/Lab3_DatamanagementLab/gradlew new file mode 100644 index 0000000000000000000000000000000000000000..cccdd3d517fc5249beaefa600691cf150f2fa3e6 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/Labs/Lab3_DatamanagementLab/gradlew.bat b/Labs/Lab3_DatamanagementLab/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..f9553162f122c71b34635112e717c3e733b5b212 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Labs/Lab3_DatamanagementLab/local.properties b/Labs/Lab3_DatamanagementLab/local.properties new file mode 100644 index 0000000000000000000000000000000000000000..6aff96b7ef63eea511940058a7b3cc10e9665e0f --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Wed Feb 16 02:37:44 EST 2022 +sdk.dir=C\:\\Users\\Sriram\\AppData\\Local\\Android\\Sdk diff --git a/Labs/Lab3_DatamanagementLab/settings.gradle b/Labs/Lab3_DatamanagementLab/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..aa814ae8e8d2f738110d0bf317f7566c614017b3 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/settings.gradle @@ -0,0 +1,2 @@ +include ':app' +rootProject.name='testapp' diff --git a/Labs/Lab3_DatamanagementLab/testapp.iml b/Labs/Lab3_DatamanagementLab/testapp.iml new file mode 100644 index 0000000000000000000000000000000000000000..c77c7e745525665045c9278f98f64e4b9ee30220 --- /dev/null +++ b/Labs/Lab3_DatamanagementLab/testapp.iml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module external.linked.project.id="testapp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> + <component name="FacetManager"> + <facet type="java-gradle" name="Java-Gradle"> + <configuration> + <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> + <option name="BUILDABLE" value="false" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <excludeFolder url="file://$MODULE_DIR$/.gradle" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/.gitignore b/Labs/Lab3_Permissions/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ceff37eff0e621e8f96607f26a6bced4727fb5a5 --- /dev/null +++ b/Labs/Lab3_Permissions/.gitignore @@ -0,0 +1,39 @@ +# built application files +*.apk +*.ap_ + +# files for the dex VM +*.dex + +# Java class files +*.class + +# generated files +bin/ +gen/ + +# Local configuration file (sdk path, etc) +local.properties + +# Eclipse project files +.classpath +.settings + +# Proguard folder generated by Eclipse +proguard/ + +# Intellij project files +*.iml +*.ipr +*.iws +.idea +.idea/workspace.xml +.gradle +build/ +captures/ + +# Mac files +.DS_Store + +# Windows thumbnail db +Thumbs.db diff --git a/Labs/Lab3_Permissions/Lab3_Permissions.pdf b/Labs/Lab3_Permissions/Lab3_Permissions.pdf new file mode 100644 index 0000000000000000000000000000000000000000..872e11f645eb5a6986e5f52016f306f4dc493669 Binary files /dev/null and b/Labs/Lab3_Permissions/Lab3_Permissions.pdf differ diff --git a/Labs/Lab3_Permissions/Permissions_Lab.webm b/Labs/Lab3_Permissions/Permissions_Lab.webm new file mode 100644 index 0000000000000000000000000000000000000000..3494ba396b31c0d2dc832383e3013e8e57e33fc5 Binary files /dev/null and b/Labs/Lab3_Permissions/Permissions_Lab.webm differ diff --git a/Labs/Lab3_Permissions/app/build.gradle b/Labs/Lab3_Permissions/app/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..f558da10cbcfda1e367dc35d16c0d82542097eea --- /dev/null +++ b/Labs/Lab3_Permissions/app/build.gradle @@ -0,0 +1,43 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion 31 + buildToolsVersion '31.0.0' + + defaultConfig { + applicationId "course.labs.permissionslab" + minSdkVersion 26 + targetSdkVersion 31 + testInstrumentationRunnerArguments clearPackageData: 'true' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' + + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } +} + +dependencies { + androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.0' + androidTestImplementation 'androidx.test:rules:1.4.1-alpha03' + androidTestImplementation 'androidx.test:rules:1.4.1-alpha03' + androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' + implementation 'androidx.annotation:annotation:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha03' +} + +configurations.all { + resolutionStrategy.force 'com.android.support:support-annotations:26.0.0' +} +repositories { + mavenCentral() + google() +} \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/PhoneNumberPermissionTest.kt b/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/PhoneNumberPermissionTest.kt new file mode 100644 index 0000000000000000000000000000000000000000..3ecf8782e4b3507f0f17b449f5ec890b0956d5ea --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/PhoneNumberPermissionTest.kt @@ -0,0 +1,117 @@ +package course.labs.permissionslab.tests + + +import android.os.Build +import android.util.Log +import android.view.View +import android.view.ViewGroup +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.action.ViewActions.click +import androidx.test.espresso.assertion.ViewAssertions.matches +import androidx.test.espresso.matcher.ViewMatchers.* +import androidx.test.filters.LargeTest +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.rule.ActivityTestRule +import androidx.test.rule.GrantPermissionRule +import androidx.test.runner.AndroidJUnit4 +import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.UiSelector +import course.labs.permissionslab.ActivityLoaderActivity +import course.labs.permissionslab.R +import junit.framework.Assert +import org.hamcrest.Description +import org.hamcrest.Matcher +import org.hamcrest.Matchers.allOf +import org.hamcrest.TypeSafeMatcher +import org.hamcrest.core.StringContains.containsString +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@LargeTest +@RunWith(AndroidJUnit4::class) +class PhoneNumberPermissionTest { + + @Rule + @JvmField + var mActivityTestRule = ActivityTestRule(ActivityLoaderActivity::class.java) + +// @Rule +// @JvmField +// var mGrantPermissionRule = +// GrantPermissionRule.grant( +// "android.permission.SEND_SMS", +// "android.permission.READ_PHONE_NUMBERS", +// "android.permission.READ_PHONE_STATE" +// ) + + @Test + fun phoneNumberPermissionTest() { + val button = onView( + allOf( + withId(R.id.start_phone_status_button), withText("PhoneStatus Activity"), + childAtPosition( + childAtPosition( + withId(android.R.id.content), + 0 + ), + 0 + ), + isDisplayed() + ) + ) + button.perform(click()) + + val button2 = onView( + allOf( + withId(R.id.get_phone_number_button), withText("Get Phone Number"), + childAtPosition( + childAtPosition( + withId(android.R.id.content), + 0 + ), + 1 + ), + isDisplayed() + ) + ) + button2.perform(click()) + grantPermission() + val textView = onView( + allOf( + withId(R.id.text), + withParent(withParent(withId(android.R.id.content))), + isDisplayed() + ) + ) + textView.check(matches(withText(containsString("Phone Number: +")))) + } + + private fun childAtPosition( + parentMatcher: Matcher<View>, position: Int + ): Matcher<View> { + + return object : TypeSafeMatcher<View>() { + override fun describeTo(description: Description) { + description.appendText("Child at position $position in parent ") + parentMatcher.describeTo(description) + } + + public override fun matchesSafely(view: View): Boolean { + val parent = view.parent + return parent is ViewGroup && parentMatcher.matches(parent) + && view == parent.getChildAt(position) + } + } + } + fun grantPermission() { + val instrumentation = InstrumentationRegistry.getInstrumentation() + if (Build.VERSION.SDK_INT >= 23) { + val allowPermission = UiDevice.getInstance(instrumentation).findObject( + UiSelector().text("Allow") + ) + Assert.assertTrue(allowPermission.exists()) + allowPermission.click() + } + } +} diff --git a/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/TestDangerousActivityPermission.kt b/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/TestDangerousActivityPermission.kt new file mode 100644 index 0000000000000000000000000000000000000000..af8c112457488ef80eaa9738e97da33360077482 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/androidTest/java/course/labs/permissionslab/tests/TestDangerousActivityPermission.kt @@ -0,0 +1,121 @@ +package course.labs.permissionslab.tests + + +import android.os.Build +import android.util.Log +import android.view.View +import android.view.ViewGroup +import androidx.test.espresso.Espresso.onView +import androidx.test.espresso.action.ViewActions.click +import androidx.test.espresso.matcher.ViewMatchers.* +import androidx.test.filters.LargeTest +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.rule.ActivityTestRule +import androidx.test.runner.AndroidJUnit4 +import androidx.test.uiautomator.UiDevice +import androidx.test.uiautomator.UiSelector +import course.labs.permissionslab.ActivityLoaderActivity +import course.labs.permissionslab.R +import junit.framework.Assert.assertTrue +import org.hamcrest.Description +import org.hamcrest.Matcher +import org.hamcrest.Matchers.allOf +import org.hamcrest.TypeSafeMatcher +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@LargeTest +@RunWith(AndroidJUnit4::class) +class TestDangerousActivityPermission { + + @Rule + @JvmField + var mActivityTestRule = ActivityTestRule(ActivityLoaderActivity::class.java) + +// @Rule +// @JvmField +// var mGrantPermissionRule = +// GrantPermissionRule.grant( +// "course.labs.permissions.DANGEROUS_ACTIVITY_PERM" +// ) + + @Test + fun dangerousActivityPermission() { + val button = onView( + allOf( + withId(R.id.start_phone_status_button), withText("PhoneStatus Activity"), + childAtPosition( + childAtPosition( + withId(android.R.id.content), + 0 + ), + 0 + ), + isDisplayed() + ) + ) + button.perform(click()) + + val button2 = onView( + allOf( + withId(R.id.go_to_dangerous_activity_button), withText("Go To DangerousActivity"), + childAtPosition( + childAtPosition( + withId(android.R.id.content), + 0 + ), + 2 + ), + isDisplayed() + ) + ) + button2.perform(click()) + + val button3 = onView( + allOf( + withId(R.id.start_dangerous_activity_button), withText("Start Dangerous Activity"), + childAtPosition( + childAtPosition( + withId(android.R.id.content), + 0 + ), + 1 + ), + isDisplayed() + ) + ) + button3.perform(click()) + grantPermission() + } + + private fun childAtPosition( + parentMatcher: Matcher<View>, position: Int + ): Matcher<View> { + + return object : TypeSafeMatcher<View>() { + override fun describeTo(description: Description) { + description.appendText("Child at position $position in parent ") + parentMatcher.describeTo(description) + } + + public override fun matchesSafely(view: View): Boolean { + val parent = view.parent + return parent is ViewGroup && parentMatcher.matches(parent) + && view == parent.getChildAt(position) + } + } + } + + fun grantPermission() { + val instrumentation = InstrumentationRegistry.getInstrumentation() + if (Build.VERSION.SDK_INT >= 23) { + val allowPermission = UiDevice.getInstance(instrumentation).findObject( + UiSelector().text("Allow") + ) + assertTrue(allowPermission.exists()) + allowPermission.click() + + } + } +} diff --git a/Labs/Lab3_Permissions/app/src/androidTest/res/.gitkeep b/Labs/Lab3_Permissions/app/src/androidTest/res/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Labs/Lab3_Permissions/app/src/main/AndroidManifest.xml b/Labs/Lab3_Permissions/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..aea797d7ed7291b57d1aff5ac4e4b564eb706d4e --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="course.labs.permissionslab" + android:versionCode="1" + android:versionName="1.0" > + +<!-- TODO add uses permission elements for Reading Phone State, Reading Phone Number, Reading SMS and for Custom Dangerous permission--> + + <application + android:allowBackup="true" + android:icon="@drawable/ic_launcher" + android:label="@string/app_name" + android:theme="@style/AppTheme" > + <activity + android:name=".ActivityLoaderActivity" + android:label="@string/title_main" + android:exported="true" + > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity + android:name=".PhoneStatusActivity" + android:label="@string/title_permissions" + android:exported="true" + > + </activity> + <activity + android:name=".GoToDangerousActivity" + android:label="@string/title_activity_customization" + android:exported="true" + > + </activity> + </application> + +</manifest> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/ActivityLoaderActivity.kt b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/ActivityLoaderActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..ad0ed3f92eb1f1211c13db42b19260a3350eb883 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/ActivityLoaderActivity.kt @@ -0,0 +1,30 @@ +package course.labs.permissionslab + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.util.Log +import android.view.View +import android.view.View.OnClickListener +import android.widget.Button + +class ActivityLoaderActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_loader_activity) + + val startPhoneStatusButton = findViewById<View>(R.id.start_phone_status_button) as Button + // TODO - Add onClickListener to the startPhoneStatusButton to call startPhoneStatusActivity() + } + + private fun startPhoneStatusActivity() { + Log.i(TAG, "Entered startPhoneStatusActivity()") + + // TODO - Start the PhoneStatusActivity + } + + companion object { + + private val TAG = "Lab-Permissions" + } +} diff --git a/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/GoToDangerousActivity.kt b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/GoToDangerousActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..641b11f5aedfd1afc9956026b6cd4615e16af680 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/GoToDangerousActivity.kt @@ -0,0 +1,65 @@ +package course.labs.permissionslab + +import android.app.Activity +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import android.os.Bundle +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat +import android.util.Log +import android.view.View +import android.widget.Button + +class GoToDangerousActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.go_to_dangerous_activity) + + // TODO - Set startDangerousActivityButton value to the button with id R.id.start_dangerous_activity_button + + // TODO - Add onClickListener to the startDangerousActivityButton to call startDangerousActivity() + // First Check DANGEROUS_ACTIVITY_PERM has been permitted if not request permission, else call + + + } + + override fun onRequestPermissionsResult(requestCode: Int, + permissions: Array<String>, grantResults: IntArray) { + when (requestCode) { + MY_PERMISSIONS_REQUEST_DANGEROUS_ACTIVITY -> { + // If request is cancelled, the result arrays are empty. + if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + + startDangerousActivity() + + } else { + + Log.i(TAG, "Dangerous App won't open --- Permission was not granted") + + } + return + } + }// other 'case' lines to check for other + // permissions this app might request + } + + private fun startDangerousActivity() { + + Log.i(TAG, "Entered startDangerousActivity()") + + startActivity(Intent(DANGEROUS_ACTIVITY_ACTION)) + + + } + + companion object { + + private val TAG = "Lab-Permissions" + val MY_PERMISSIONS_REQUEST_DANGEROUS_ACTIVITY = 2 + + private val DANGEROUS_ACTIVITY_ACTION = "course.labs.permissions.DANGEROUS_ACTIVITY" + } + +} diff --git a/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/PhoneStatusActivity.kt b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/PhoneStatusActivity.kt new file mode 100644 index 0000000000000000000000000000000000000000..2e50962d3c31279359e8c15f004515ed6b563754 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/java/course/labs/permissionslab/PhoneStatusActivity.kt @@ -0,0 +1,82 @@ +package course.labs.permissionslab + +import android.Manifest +import android.annotation.SuppressLint +import android.app.Activity +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import android.os.Bundle +import android.telephony.TelephonyManager +import android.util.Log +import android.view.View +import android.widget.Button +import android.widget.TextView +import androidx.core.app.ActivityCompat +import androidx.core.content.ContextCompat + +class PhoneStatusActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.phone_status_activity) + + val getPhoneNumButton = findViewById<View>(R.id.get_phone_number_button) as Button + // TODO - Add onClickListener to the getPhoneNumButton to call loadPhoneNumber() + // First Check whether for [READ_PHONE_STATE, SEND_SMS, READ_PHONE_NUMBERS] has been provided if not request permission, else call + + + val goToDangerousActivityButton = findViewById<View>(R.id.go_to_dangerous_activity_button) as Button + // TODO - Add onClickListener to the goToDangerousActivityButton to call startGoToDangerousActivity() + + } + + @SuppressLint("MissingPermission") + private fun loadPhoneNumber() { + + val tMgr = getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager + val mPhoneNumber = tMgr.line1Number + + val box = findViewById<View>(R.id.text) as TextView + box.text = "Phone Number: $mPhoneNumber" + + Log.i(TAG, "Phone Number loaded") + } + + override fun onRequestPermissionsResult(requestCode: Int, + permissions: Array<String>, grantResults: IntArray) { + when (requestCode) { + MY_PERMISSIONS_REQUEST_READ_PHONE_STATE -> { + // If request is cancelled, the result arrays are empty. + if (grantResults.size > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { + + loadPhoneNumber() + + } else { + + Log.i(TAG, "Phone Number was not loaded --- Permission was not granted") + + } + return + } + }// other 'case' lines to check for other + // permissions this app might request + } + + private fun startGoToDangerousActivity() { + + Log.i(TAG, "Entered startGoToDangerousActivity()") + + // TODO - Start the GoToDangerousActivity + + + } + + companion object { + + private val TAG = "Lab-Permissions" + val MY_PERMISSIONS_REQUEST_READ_PHONE_STATE = 1 + } + +} diff --git a/Labs/Lab3_Permissions/app/src/main/res/drawable-hdpi/ic_launcher.png b/Labs/Lab3_Permissions/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..0e79b184fcf8cc47dede6d7ccde00d1a1e2d9c23 Binary files /dev/null and b/Labs/Lab3_Permissions/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/Labs/Lab3_Permissions/app/src/main/res/drawable-ldpi/ic_launcher.png b/Labs/Lab3_Permissions/app/src/main/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..ebfac7d78b9e17c113f734d10af74bd2b100beba Binary files /dev/null and b/Labs/Lab3_Permissions/app/src/main/res/drawable-ldpi/ic_launcher.png differ diff --git a/Labs/Lab3_Permissions/app/src/main/res/drawable-mdpi/ic_launcher.png b/Labs/Lab3_Permissions/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..1183441937efcae0151b75099bec444d034886e9 Binary files /dev/null and b/Labs/Lab3_Permissions/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/Labs/Lab3_Permissions/app/src/main/res/drawable-xhdpi/ic_launcher.png b/Labs/Lab3_Permissions/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..c8ab2a114716b712ec0c5122f9e9524afaa60b52 Binary files /dev/null and b/Labs/Lab3_Permissions/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/Labs/Lab3_Permissions/app/src/main/res/layout/activity_loader_activity.xml b/Labs/Lab3_Permissions/app/src/main/res/layout/activity_loader_activity.xml new file mode 100644 index 0000000000000000000000000000000000000000..0a81a63524d1c376e9df6ed89732b114089bdb4d --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/layout/activity_loader_activity.xml @@ -0,0 +1,14 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".ActivityLoaderActivity" > + + <Button + android:id="@+id/start_phone_status_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/main_button3" /> + +</LinearLayout> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/layout/go_to_dangerous_activity.xml b/Labs/Lab3_Permissions/app/src/main/res/layout/go_to_dangerous_activity.xml new file mode 100644 index 0000000000000000000000000000000000000000..a657661650296aa375fc0528641fd09cda48518d --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/layout/go_to_dangerous_activity.xml @@ -0,0 +1,18 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/cust_message" /> + + <Button + android:id="@+id/start_dangerous_activity_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/cust_button1" /> + +</LinearLayout> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/layout/phone_status_activity.xml b/Labs/Lab3_Permissions/app/src/main/res/layout/phone_status_activity.xml new file mode 100644 index 0000000000000000000000000000000000000000..eed6220b60a26af0f292f36d492f90e238da2296 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/layout/phone_status_activity.xml @@ -0,0 +1,26 @@ +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" > + + <TextView + android:id="@+id/text" + android:layout_width="match_parent" + android:layout_height="250dp" + android:maxHeight="250dp" + android:text="@string/place_holder" /> + + <Button + android:id="@+id/get_phone_number_button" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/perms_button1" /> + + <Button + android:id="@+id/go_to_dangerous_activity_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/perms_button2" /> + +</LinearLayout> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/values-v11/styles.xml b/Labs/Lab3_Permissions/app/src/main/res/values-v11/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..541752f6edf47a27cad70a23c00cc17aa4c84c08 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/values-v11/styles.xml @@ -0,0 +1,11 @@ +<resources> + + <!-- + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light"> + <!-- API 11 theme customizations can go here. --> + </style> + +</resources> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/values-v14/styles.xml b/Labs/Lab3_Permissions/app/src/main/res/values-v14/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..f20e01501dfde7d1f4cc9c29f85169ce57bc5846 --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/values-v14/styles.xml @@ -0,0 +1,12 @@ +<resources> + + <!-- + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> + <!-- API 14 theme customizations can go here. --> + </style> + +</resources> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/values/strings.xml b/Labs/Lab3_Permissions/app/src/main/res/values/strings.xml new file mode 100644 index 0000000000000000000000000000000000000000..f0d33c4bc41a1ad017eb44c0e53a297be981f34d --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/values/strings.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <string name="app_name">PermissionsLab</string> + <string name="title_main">PermissionsLab</string> + <string name="main_button3">PhoneStatus Activity</string> + <string name="title_permissions">Permissions</string> + <string name="perms_button1">Get Phone Number</string> + <string name="perms_button2">Go To DangerousActivity</string> + <string name="place_holder">Phone Number Goes Here</string> + <string name="title_activity_customization">Customization</string> + <string name="cust_button1">Start Dangerous Activity</string> + <string name="cust_message">This button will load a Dangerous Level activity</string> + +</resources> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/app/src/main/res/values/styles.xml b/Labs/Lab3_Permissions/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000000000000000000000000000000000..4a10ca492dd2610011d3979b4dc551f471fa27ab --- /dev/null +++ b/Labs/Lab3_Permissions/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ +<resources> + + <!-- + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + --> + <style name="AppBaseTheme" parent="android:Theme.Light"> + <!-- + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + --> + </style> + + <!-- Application theme. --> + <style name="AppTheme" parent="AppBaseTheme"> + <!-- All customizations that are NOT specific to a particular API-level can go here. --> + </style> + +</resources> \ No newline at end of file diff --git a/Labs/Lab3_Permissions/build.gradle b/Labs/Lab3_Permissions/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..41b691baaa0dbb060cb4f121d1d5d5b6e625acb7 --- /dev/null +++ b/Labs/Lab3_Permissions/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + ext.kotlin_version = '1.6.10' + repositories { + jcenter() + google() + } + dependencies { + classpath 'com.android.tools.build:gradle:7.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +allprojects { + repositories { + jcenter() + google() + } +} diff --git a/Labs/Lab3_Permissions/gradle.properties b/Labs/Lab3_Permissions/gradle.properties new file mode 100644 index 0000000000000000000000000000000000000000..5465fec0ecadbf086fce0db92293c8f1d5f720ff --- /dev/null +++ b/Labs/Lab3_Permissions/gradle.properties @@ -0,0 +1,2 @@ +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.jar b/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 Binary files /dev/null and b/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.properties b/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000000000000000000000000000000000..d65d952bef03bff12c16ec069d94e7ba833f5645 --- /dev/null +++ b/Labs/Lab3_Permissions/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue Feb 15 03:25:49 EST 2022 +distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionPath=wrapper/dists +zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME diff --git a/Labs/Lab3_Permissions/gradlew b/Labs/Lab3_Permissions/gradlew new file mode 100755 index 0000000000000000000000000000000000000000..9d82f78915133e1c35a6ea51252590fb38efac2f --- /dev/null +++ b/Labs/Lab3_Permissions/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/Labs/Lab3_Permissions/gradlew.bat b/Labs/Lab3_Permissions/gradlew.bat new file mode 100644 index 0000000000000000000000000000000000000000..8a0b282aa6885fb573c106b3551f7275c5f17e8e --- /dev/null +++ b/Labs/Lab3_Permissions/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Labs/Lab3_Permissions/settings.gradle b/Labs/Lab3_Permissions/settings.gradle new file mode 100644 index 0000000000000000000000000000000000000000..e7b4def49cb53d9aa04228dd3edb14c9e635e003 --- /dev/null +++ b/Labs/Lab3_Permissions/settings.gradle @@ -0,0 +1 @@ +include ':app'