├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── gradle.xml ├── misc.xml └── vcs.xml ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── mobile.png ├── wear_1.png ├── wear_2.png ├── wear_3.png └── wear_4.png ├── mobile ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── de │ │ └── rhaeus │ │ └── dndsync │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── ic_launcher-playstore.png │ ├── java │ │ └── de │ │ │ └── rhaeus │ │ │ └── dndsync │ │ │ ├── DNDNotificationService.java │ │ │ ├── DNDSyncListenerService.java │ │ │ ├── MainActivity.java │ │ │ └── MainFragment.java │ └── res │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── ic_launcher_background.xml │ │ ├── strings.xml │ │ ├── themes.xml │ │ └── wear.xml │ │ └── xml │ │ └── root_preferences.xml │ └── test │ └── java │ └── de │ └── rhaeus │ └── dndsync │ └── ExampleUnitTest.java ├── settings.gradle └── wear ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── ic_launcher-playstore.png ├── java └── de │ └── rhaeus │ └── dndsync │ ├── DNDNotificationService.java │ ├── DNDSyncAccessService.java │ ├── DNDSyncListenerService.java │ ├── MainActivity.java │ └── MainFragment.java └── res ├── layout └── activity_main.xml ├── mipmap-anydpi-v26 ├── ic_launcher.xml └── ic_launcher_round.xml ├── mipmap-hdpi ├── ic_launcher.png ├── ic_launcher_foreground.png └── ic_launcher_round.png ├── mipmap-mdpi ├── ic_launcher.png ├── ic_launcher_foreground.png └── ic_launcher_round.png ├── mipmap-xhdpi ├── ic_launcher.png ├── ic_launcher_foreground.png └── ic_launcher_round.png ├── mipmap-xxhdpi ├── ic_launcher.png ├── ic_launcher_foreground.png └── ic_launcher_round.png ├── mipmap-xxxhdpi ├── ic_launcher.png ├── ic_launcher_foreground.png └── ic_launcher_round.png ├── values-round └── strings.xml ├── values ├── colors.xml ├── dimens.xml ├── ic_launcher_background.xml ├── strings.xml ├── themes.xml └── wear.xml └── xml ├── accessibility_service_config.xml └── root_preferences.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DNDSync 2 | This App was developed to enable Do Not Disturb (DND) synchronization between my Pixel phone and the Galaxy Watch 4 3 | since this option was only available if paired with a Samsung phone. 4 | 5 | If installed on phone and watch it enables either a 1-way sync or a 2-way sync, depending on the preferences. 6 | I also added the functionality to automatically toggle Bedtime Mode. Use case: At night I put my phone into DND and I want my watch to automatically enable Bedtime Mode. 7 | This functionality is realized via an Accessibility Service, since I couldn't find how to enable it programmatically (any hints are highly appreciated). 8 | 9 | NOTE: For Bedtime mode toggle to work it is important that on the watch the Bedtime Mode button is on the first page of quick settings and the middle button in the first row! 10 | 11 | Part of this project is inspired by [blundens](https://github.com/blunden/DoNotDisturbSync) work, please check their GitHub if you want to know more. 12 | 13 | _**Tested on Pixel 3a XL paired with a Galaxy Watch 4 (40mm)**_ 14 | 15 | DNDSync demo 18 | 19 | Video link: https://youtu.be/rHy6kCBNOzA 20 | 21 | ## 22 | 23 | ## Setup 24 | _For now the App is not in the Play Store. Manual installation is required. The use of ADB is required._ 25 | * Download the .apk files from the release section (_dndsync_mobile.apk_ and _dndsync_wear.apk_) 26 | 27 | ### Phone 28 | 29 | 30 | 31 | * Install _dndsync_mobile.apk_ on the phone `adb install dndsync_mobile.apk` 32 | * Open the App and grant the permission for DND Access by clicking on the menu entry _DND Permission_. 33 | This will open the permission screen. This Permission is required so that the app can read and write DND state. 34 | Without this permission the sync will not work. 35 | * With the switch _Sync DND state to watch_ you can enable and disable the sync. If enabled a DND change on the phone will lead to DND change on the watch. 36 | 37 | ### Watch 38 |

39 | 40 | 41 | 42 | 43 |

44 | 45 | Setting up the watch is a bit more tricky since the watch OS lacks the permission screen for DND access. I found a way to enable the permission via ADB. 46 | 47 | Note: This is only tested on my Galaxy Watch 4 and it might not work on other devices! 48 | * Connect the watch to your computer via adb (watch and computer have to be in the same network!) 49 | * enable Developer Options: Go to Settings -> About watch -> Software -> tap the Software version 5 times -> developer mode is on (you can disable it in the same way) 50 | * enable _ADB debugging_ and _Debug over WIFI_ (in Settings -> Developer Options) 51 | * note the watch IP address and port, something like `192.168.0.100:5555` 52 | * connect to the watch with `adb connect 192.168.0.100:5555` (_**insert your value!**_) 53 | * install the app `adb install dndsync_wear.apk` 54 | * grant permission for DND access 55 | `adb shell cmd notification allow_listener de.rhaeus.dndsync/de.rhaeus.dndsync.DNDNotificationService` 56 | This allows the app to listen to DND changes and changing the DND setting 57 | * scroll to the permission section and check if DND permission says _access granted_ (you might need to tap on the menu entry for it to update) 58 | * _**IMPORTANT: Disable ADB debugging after you are done because it drains the battery!**_ 59 | * If you want to use the Bedtime mode feature you have to enable the Accessibility service for the app. Clicking on _Accessibility Service_ will open the setting on your watch. 60 | Go to _Installed Services_ and enable _DNDSync_. The App will use this to simulate the following touch events on the screen: 61 | swipe down to open Quick Settings Panel, click the middle icon of the first row (put Bedtime Mode here) and finally close the panel. 62 | You can enable this by enabling the _Bedtime Mode_ Setting in the App. 63 | * If you enable the setting _Sync DND_ in the App a DND change on the watch will lead to a DND change on the phone 64 | * If you enable the setting _Vibration_ in the App the watch will vibrate when it receives a DND sync request from the phone 65 | 66 | # Feedback 67 | Feel free to contact me for questions, feature ideas or bugs and I will see if I can do something about it 68 | 69 | email: rhaeus.dev@gmail.com 70 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | task clean(type: Delete) { 4 | delete rootProject.buildDir 5 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Enables namespacing of each library's R class so that its R class includes only the 21 | # resources declared in the library itself and none from the library's dependencies, 22 | # thereby reducing the size of the R class for that library 23 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 27 12:48:49 CEST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-rc-3-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /images/mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/images/mobile.png -------------------------------------------------------------------------------- /images/wear_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/images/wear_1.png -------------------------------------------------------------------------------- /images/wear_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/images/wear_2.png -------------------------------------------------------------------------------- /images/wear_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/images/wear_3.png -------------------------------------------------------------------------------- /images/wear_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/images/wear_4.png -------------------------------------------------------------------------------- /mobile/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /mobile/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdk 31 7 | 8 | defaultConfig { 9 | applicationId "de.rhaeus.dndsync" 10 | minSdk 24 11 | targetSdk 31 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 22 | } 23 | } 24 | compileOptions { 25 | sourceCompatibility JavaVersion.VERSION_1_8 26 | targetCompatibility JavaVersion.VERSION_1_8 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation 'androidx.appcompat:appcompat:1.3.1' 32 | implementation 'com.google.android.material:material:1.4.0' 33 | implementation 'com.google.android.gms:play-services-wearable:17.1.0' 34 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0' 35 | implementation 'androidx.preference:preference:1.1.1' 36 | testImplementation 'junit:junit:4.13.2' 37 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 38 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 39 | 40 | } -------------------------------------------------------------------------------- /mobile/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /mobile/src/androidTest/java/de/rhaeus/dndsync/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("de.rhaeus.dndsync", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /mobile/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /mobile/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /mobile/src/main/java/de/rhaeus/dndsync/DNDNotificationService.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | 4 | import android.content.SharedPreferences; 5 | import android.service.notification.NotificationListenerService; 6 | import android.util.Log; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.preference.PreferenceManager; 10 | 11 | import com.google.android.gms.tasks.OnFailureListener; 12 | import com.google.android.gms.tasks.OnSuccessListener; 13 | import com.google.android.gms.tasks.Task; 14 | import com.google.android.gms.tasks.Tasks; 15 | import com.google.android.gms.wearable.CapabilityClient; 16 | import com.google.android.gms.wearable.CapabilityInfo; 17 | import com.google.android.gms.wearable.Node; 18 | import com.google.android.gms.wearable.Wearable; 19 | 20 | import java.util.Set; 21 | import java.util.concurrent.ExecutionException; 22 | 23 | public class DNDNotificationService extends NotificationListenerService { 24 | private static final String TAG = "DNDNotificationService"; 25 | private static final String DND_SYNC_CAPABILITY_NAME = "dnd_sync"; 26 | private static final String DND_SYNC_MESSAGE_PATH = "/wear-dnd-sync"; 27 | 28 | public static boolean running = false; 29 | 30 | @Override 31 | public void onListenerConnected() { 32 | Log.d(TAG, "listener connected"); 33 | running = true; 34 | } 35 | 36 | @Override 37 | public void onListenerDisconnected() { 38 | Log.d(TAG, "listener disconnected"); 39 | running = false; 40 | } 41 | 42 | @Override 43 | public void onInterruptionFilterChanged (int interruptionFilter) { 44 | Log.d(TAG, "interruption filter changed to " + interruptionFilter); 45 | 46 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 47 | boolean syncDnd = prefs.getBoolean("dnd_sync_key", true); 48 | if(syncDnd) { 49 | new Thread(new Runnable() { 50 | public void run() { 51 | sendDNDSync(interruptionFilter); 52 | } 53 | }).start(); 54 | } 55 | } 56 | 57 | private void sendDNDSync(int dndState) { 58 | // https://developer.android.com/training/wearables/data/messages 59 | 60 | // search nodes for sync 61 | CapabilityInfo capabilityInfo = null; 62 | try { 63 | capabilityInfo = Tasks.await( 64 | Wearable.getCapabilityClient(this).getCapability( 65 | DND_SYNC_CAPABILITY_NAME, CapabilityClient.FILTER_REACHABLE)); 66 | } catch (ExecutionException e) { 67 | e.printStackTrace(); 68 | Log.e(TAG, "execution error while searching nodes", e); 69 | return; 70 | } catch (InterruptedException e) { 71 | e.printStackTrace(); 72 | Log.e(TAG, "interruption error while searching nodes", e); 73 | return; 74 | } 75 | 76 | // send request to all reachable nodes 77 | // capabilityInfo has the reachable nodes with the dnd sync capability 78 | Set connectedNodes = capabilityInfo.getNodes(); 79 | if (connectedNodes.isEmpty()) { 80 | // Unable to retrieve node with transcription capability 81 | Log.d(TAG, "Unable to retrieve node with sync capability!"); 82 | } else { 83 | for (Node node : connectedNodes) { 84 | if (node.isNearby()) { 85 | byte[] data = new byte[1]; 86 | data[0] = (byte) dndState; 87 | Task sendTask = 88 | Wearable.getMessageClient(this).sendMessage(node.getId(), DND_SYNC_MESSAGE_PATH, data); 89 | 90 | sendTask.addOnSuccessListener(new OnSuccessListener() { 91 | @Override 92 | public void onSuccess(Integer integer) { 93 | Log.d(TAG, "send successful! Receiver node id: " + node.getId()); 94 | } 95 | }); 96 | 97 | sendTask.addOnFailureListener(new OnFailureListener() { 98 | @Override 99 | public void onFailure(@NonNull Exception e) { 100 | Log.d(TAG, "send failed! Receiver node id: " + node.getId()); 101 | } 102 | }); 103 | } 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /mobile/src/main/java/de/rhaeus/dndsync/DNDSyncListenerService.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.app.NotificationManager; 4 | import android.content.Context; 5 | import android.os.Handler; 6 | import android.os.PowerManager; 7 | import android.os.VibrationEffect; 8 | import android.os.Vibrator; 9 | import android.util.Log; 10 | import android.widget.Toast; 11 | 12 | import androidx.annotation.NonNull; 13 | 14 | import com.google.android.gms.wearable.MessageEvent; 15 | import com.google.android.gms.wearable.WearableListenerService; 16 | 17 | public class DNDSyncListenerService extends WearableListenerService { 18 | private static final String TAG = "DNDSyncListenerService"; 19 | private static final String DND_SYNC_MESSAGE_PATH = "/wear-dnd-sync"; 20 | 21 | 22 | @Override 23 | public void onMessageReceived (@NonNull MessageEvent messageEvent) { 24 | Log.d(TAG, "onMessageReceived: " + messageEvent); 25 | 26 | if (messageEvent.getPath().equalsIgnoreCase(DND_SYNC_MESSAGE_PATH)) { 27 | Log.d(TAG, "received path: " + DND_SYNC_MESSAGE_PATH); 28 | 29 | byte[] data = messageEvent.getData(); 30 | // data[0] contains dnd mode of phone 31 | // 0 = INTERRUPTION_FILTER_UNKNOWN 32 | // 1 = INTERRUPTION_FILTER_ALL (all notifications pass) 33 | // 2 = INTERRUPTION_FILTER_PRIORITY 34 | // 3 = INTERRUPTION_FILTER_NONE (no notification passes) 35 | // 4 = INTERRUPTION_FILTER_ALARMS 36 | byte dndStatePhone = data[0]; 37 | Log.d(TAG, "dndStatePhone: " + dndStatePhone); 38 | 39 | // get dnd state 40 | NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 41 | 42 | int filterState = mNotificationManager.getCurrentInterruptionFilter(); 43 | if (filterState < 0 || filterState > 4) { 44 | Log.d(TAG, "DNDSync weird current dnd state: " + filterState); 45 | } 46 | byte currentDndState = (byte) filterState; 47 | Log.d(TAG, "currentDndState: " + currentDndState); 48 | 49 | if (dndStatePhone != currentDndState) { 50 | Log.d(TAG, "dndStatePhone != currentDndState: " + dndStatePhone + " != " + currentDndState); 51 | if (mNotificationManager.isNotificationPolicyAccessGranted()) { 52 | mNotificationManager.setInterruptionFilter(dndStatePhone); 53 | Log.d(TAG, "DND set to " + dndStatePhone); 54 | } else { 55 | Log.d(TAG, "attempting to set DND but access not granted"); 56 | } 57 | } 58 | 59 | } else { 60 | super.onMessageReceived(messageEvent); 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /mobile/src/main/java/de/rhaeus/dndsync/MainActivity.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | @Override 8 | protected void onCreate(Bundle savedInstanceState) { 9 | super.onCreate(savedInstanceState); 10 | setContentView(R.layout.activity_main); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /mobile/src/main/java/de/rhaeus/dndsync/MainFragment.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.app.NotificationManager; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.widget.Toast; 8 | 9 | import androidx.preference.Preference; 10 | import androidx.preference.PreferenceFragmentCompat; 11 | 12 | public class MainFragment extends PreferenceFragmentCompat { 13 | private Preference dndPref; 14 | 15 | @Override 16 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 17 | setPreferencesFromResource(R.xml.root_preferences, rootKey); 18 | 19 | dndPref = findPreference("dnd_permission_key"); 20 | 21 | assert(dndPref != null); 22 | 23 | dndPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 24 | public boolean onPreferenceClick(Preference preference) { 25 | if (!checkDNDPermission()) { 26 | openDNDPermissionRequest(); 27 | } else { 28 | Toast.makeText(getContext(), "DND Permission allowed", Toast.LENGTH_SHORT).show(); 29 | } 30 | return true; 31 | } 32 | }); 33 | checkDNDPermission(); 34 | } 35 | 36 | private boolean checkDNDPermission() { 37 | NotificationManager mNotificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE); 38 | boolean allowed = mNotificationManager.isNotificationPolicyAccessGranted(); 39 | if (allowed) { 40 | dndPref.setSummary(R.string.dnd_permission_allowed); 41 | } else { 42 | dndPref.setSummary(R.string.dnd_permission_not_allowed); 43 | } 44 | return allowed; 45 | } 46 | 47 | private void openDNDPermissionRequest() { 48 | Intent intent = new Intent(android.provider.Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS); 49 | startActivity(intent); 50 | } 51 | } -------------------------------------------------------------------------------- /mobile/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/mobile/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /mobile/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #1976d2 4 | #63a4ff 5 | #004ba0 6 | 7 | #4272f5 8 | #67daff 9 | #007ac1 10 | #ffffff 11 | #000000 12 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4272F5 4 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DNDSync 3 | 4 | Permissions 5 | Sync 6 | 7 | 8 | DND Permission 9 | DND access granted 10 | DND access denied 11 | 12 | 13 | Sync DND state to watch 14 | 15 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /mobile/src/main/res/values/wear.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | dnd_sync 5 | 6 | -------------------------------------------------------------------------------- /mobile/src/main/res/xml/root_preferences.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 12 | 13 | 14 | 15 | 17 | 18 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /mobile/src/test/java/de/rhaeus/dndsync/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | plugins { 8 | id 'com.android.application' version '7.1.0-alpha10' 9 | id 'com.android.library' version '7.1.0-alpha10' 10 | } 11 | } 12 | dependencyResolutionManagement { 13 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 14 | repositories { 15 | google() 16 | mavenCentral() 17 | } 18 | } 19 | rootProject.name = "DNDSync" 20 | include ':mobile' 21 | include ':wear' 22 | -------------------------------------------------------------------------------- /wear/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /wear/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.application' 3 | } 4 | 5 | android { 6 | compileSdk 31 7 | 8 | defaultConfig { 9 | applicationId "de.rhaeus.dndsync" 10 | minSdk 30 11 | targetSdk 31 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | buildFeatures { 24 | viewBinding true 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation 'com.google.android.gms:play-services-wearable:17.1.0' 30 | implementation 'androidx.percentlayout:percentlayout:1.0.0' 31 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 32 | implementation 'androidx.recyclerview:recyclerview:1.2.1' 33 | implementation 'androidx.wear:wear:1.1.0' 34 | implementation 'androidx.preference:preference:1.1.1' 35 | implementation 'androidx.appcompat:appcompat:1.3.1' 36 | implementation 'com.google.android.material:material:1.4.0' 37 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0' 38 | 39 | } -------------------------------------------------------------------------------- /wear/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /wear/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 35 | 38 | 39 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 58 | 59 | 60 | 61 | 65 | 66 | 67 | 68 | 69 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /wear/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /wear/src/main/java/de/rhaeus/dndsync/DNDNotificationService.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | 4 | import android.content.ComponentName; 5 | import android.content.SharedPreferences; 6 | import android.content.pm.PackageManager; 7 | import android.service.notification.NotificationListenerService; 8 | import android.util.Log; 9 | import android.widget.Toast; 10 | 11 | import androidx.annotation.NonNull; 12 | import androidx.preference.PreferenceManager; 13 | 14 | import com.google.android.gms.tasks.OnFailureListener; 15 | import com.google.android.gms.tasks.OnSuccessListener; 16 | import com.google.android.gms.tasks.Task; 17 | import com.google.android.gms.tasks.Tasks; 18 | import com.google.android.gms.wearable.CapabilityClient; 19 | import com.google.android.gms.wearable.CapabilityInfo; 20 | import com.google.android.gms.wearable.Node; 21 | import com.google.android.gms.wearable.Wearable; 22 | 23 | import java.util.Set; 24 | import java.util.concurrent.ExecutionException; 25 | 26 | public class DNDNotificationService extends NotificationListenerService { 27 | private static final String TAG = "DNDNotificationService"; 28 | private static final String DND_SYNC_CAPABILITY_NAME = "dnd_sync"; 29 | private static final String DND_SYNC_MESSAGE_PATH = "/wear-dnd-sync"; 30 | 31 | public static boolean running = false; 32 | 33 | @Override 34 | public void onListenerConnected() { 35 | Log.d(TAG, "listener connected"); 36 | running = true; 37 | 38 | //TODO enable/disable service based on app setting to save battery 39 | // // We don't want to run a background service so disable and stop it 40 | // // to avoid running this service in the background 41 | // disableServiceComponent(); 42 | // Log.i(TAG, "Disabling service"); 43 | // 44 | // try { 45 | // stopSelf(); 46 | // } catch(SecurityException e) { 47 | // Log.e(TAG, "Failed to stop service"); 48 | // } 49 | } 50 | // private void disableServiceComponent() { 51 | // PackageManager p = getPackageManager(); 52 | // ComponentName componentName = new ComponentName(this, DNDNotificationService.class); 53 | // p.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); 54 | // } 55 | 56 | @Override 57 | public void onListenerDisconnected() { 58 | Log.d(TAG, "listener disconnected"); 59 | running = false; 60 | } 61 | 62 | 63 | @Override 64 | public void onInterruptionFilterChanged (int interruptionFilter) { 65 | Log.d(TAG, "interruption filter changed to " + interruptionFilter); 66 | 67 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 68 | boolean syncDnd = prefs.getBoolean("dnd_sync_key", true); 69 | if(syncDnd) { 70 | new Thread(new Runnable() { 71 | public void run() { 72 | sendDNDSync(interruptionFilter); 73 | } 74 | }).start(); 75 | } 76 | } 77 | 78 | private void sendDNDSync(int dndState) { 79 | // https://developer.android.com/training/wearables/data/messages 80 | 81 | // search nodes for sync 82 | CapabilityInfo capabilityInfo = null; 83 | try { 84 | capabilityInfo = Tasks.await( 85 | Wearable.getCapabilityClient(this).getCapability( 86 | DND_SYNC_CAPABILITY_NAME, CapabilityClient.FILTER_REACHABLE)); 87 | } catch (ExecutionException e) { 88 | e.printStackTrace(); 89 | Log.e(TAG, "execution error while searching nodes", e); 90 | return; 91 | } catch (InterruptedException e) { 92 | e.printStackTrace(); 93 | Log.e(TAG, "interruption error while searching nodes", e); 94 | return; 95 | } 96 | 97 | // send request to all reachable nodes 98 | // capabilityInfo has the reachable nodes with the dnd sync capability 99 | Set connectedNodes = capabilityInfo.getNodes(); 100 | if (connectedNodes.isEmpty()) { 101 | // Unable to retrieve node with transcription capability 102 | Log.d(TAG, "Unable to retrieve node with sync capability!"); 103 | } else { 104 | for (Node node : connectedNodes) { 105 | if (node.isNearby()) { 106 | byte[] data = new byte[2]; 107 | data[0] = (byte) dndState; 108 | Task sendTask = 109 | Wearable.getMessageClient(this).sendMessage(node.getId(), DND_SYNC_MESSAGE_PATH, data); 110 | 111 | sendTask.addOnSuccessListener(new OnSuccessListener() { 112 | @Override 113 | public void onSuccess(Integer integer) { 114 | Log.d(TAG, "send successful! Receiver node id: " + node.getId()); 115 | } 116 | }); 117 | 118 | sendTask.addOnFailureListener(new OnFailureListener() { 119 | @Override 120 | public void onFailure(@NonNull Exception e) { 121 | Log.d(TAG, "send failed! Receiver node id: " + node.getId()); 122 | } 123 | }); 124 | } 125 | } 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /wear/src/main/java/de/rhaeus/dndsync/DNDSyncAccessService.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.accessibilityservice.AccessibilityService; 4 | import android.accessibilityservice.GestureDescription; 5 | import android.content.Intent; 6 | import android.graphics.Path; 7 | import android.util.DisplayMetrics; 8 | import android.view.accessibility.AccessibilityEvent; 9 | 10 | public class DNDSyncAccessService extends AccessibilityService { 11 | 12 | private static DNDSyncAccessService instance; 13 | 14 | public static DNDSyncAccessService getSharedInstance() { 15 | return instance; 16 | } 17 | @Override 18 | protected void onServiceConnected() { 19 | instance = this; 20 | } 21 | 22 | @Override 23 | public boolean onUnbind(Intent intent) { 24 | instance = null; 25 | return super.onUnbind(intent); 26 | } 27 | 28 | @Override 29 | public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) { 30 | 31 | } 32 | 33 | @Override 34 | public void onInterrupt() { 35 | 36 | } 37 | 38 | public void openQuickSettings() { 39 | performGlobalAction(GLOBAL_ACTION_QUICK_SETTINGS); 40 | } 41 | 42 | public void goHome() { 43 | performGlobalAction(GLOBAL_ACTION_HOME); 44 | } 45 | 46 | public void openNotification() { 47 | performGlobalAction(GLOBAL_ACTION_NOTIFICATIONS); 48 | } 49 | 50 | public void goBack() { 51 | performGlobalAction(GLOBAL_ACTION_BACK); 52 | } 53 | 54 | public void click(float x, float y) { 55 | boolean result = dispatchGesture(createClick(x, y), null, null); 56 | } 57 | 58 | public void clickIcon1_2() { 59 | DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); 60 | GestureDescription.Builder gestureBuilder = new GestureDescription.Builder(); 61 | Path path = new Path(); 62 | 63 | final int height = displayMetrics.heightPixels; 64 | final int top = (int)(height * .25); 65 | final int mid = (int)(height * .5); 66 | final int bottom = (int)(height * .75); 67 | final int midX = displayMetrics.widthPixels / 2; 68 | 69 | path.moveTo(midX, (int)(height * .4)); 70 | gestureBuilder.addStroke(new GestureDescription.StrokeDescription(path, 0, 50)); 71 | dispatchGesture(gestureBuilder.build(), null, null); 72 | } 73 | 74 | public void swipeDown() { 75 | DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); 76 | GestureDescription.Builder gestureBuilder = new GestureDescription.Builder(); 77 | Path path = new Path(); 78 | 79 | final int height = displayMetrics.heightPixels; 80 | final int top = (int)(height * .25); 81 | final int mid = (int)(height * .5); 82 | final int bottom = (int)(height * .75); 83 | final int midX = displayMetrics.widthPixels / 2; 84 | 85 | path.moveTo(midX, 0); 86 | path.lineTo(midX, mid); 87 | gestureBuilder.addStroke(new GestureDescription.StrokeDescription(path, 100, 50)); 88 | dispatchGesture(gestureBuilder.build(), null, null); 89 | } 90 | 91 | 92 | // (x, y) in screen coordinates 93 | private static GestureDescription createClick(float x, float y) { 94 | // for a single tap a duration of 1 ms is enough 95 | final int DURATION = 1; 96 | 97 | Path clickPath = new Path(); 98 | clickPath.moveTo(x, y); 99 | GestureDescription.StrokeDescription clickStroke = 100 | new GestureDescription.StrokeDescription(clickPath, 0, DURATION); 101 | GestureDescription.Builder clickBuilder = new GestureDescription.Builder(); 102 | clickBuilder.addStroke(clickStroke); 103 | return clickBuilder.build(); 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /wear/src/main/java/de/rhaeus/dndsync/DNDSyncListenerService.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.app.NotificationManager; 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | import android.os.Handler; 7 | import android.os.PowerManager; 8 | import android.os.VibrationEffect; 9 | import android.os.Vibrator; 10 | import android.util.Log; 11 | import android.widget.Toast; 12 | 13 | import androidx.annotation.NonNull; 14 | import androidx.preference.PreferenceManager; 15 | 16 | import com.google.android.gms.wearable.MessageEvent; 17 | import com.google.android.gms.wearable.WearableListenerService; 18 | 19 | public class DNDSyncListenerService extends WearableListenerService { 20 | private static final String TAG = "DNDSyncListenerService"; 21 | private static final String DND_SYNC_MESSAGE_PATH = "/wear-dnd-sync"; 22 | 23 | @Override 24 | public void onMessageReceived (@NonNull MessageEvent messageEvent) { 25 | if (Log.isLoggable(TAG, Log.DEBUG)) { 26 | Log.d(TAG, "onMessageReceived: " + messageEvent); 27 | } 28 | SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 29 | 30 | if (messageEvent.getPath().equalsIgnoreCase(DND_SYNC_MESSAGE_PATH)) { 31 | Log.d(TAG, "received path: " + DND_SYNC_MESSAGE_PATH); 32 | 33 | boolean vibrate = prefs.getBoolean("vibrate_key", false); 34 | Log.d(TAG, "vibrate: " + vibrate); 35 | if (vibrate) { 36 | vibrate(); 37 | } 38 | 39 | byte[] data = messageEvent.getData(); 40 | // data[0] contains dnd mode of phone 41 | // 0 = INTERRUPTION_FILTER_UNKNOWN 42 | // 1 = INTERRUPTION_FILTER_ALL (all notifications pass) 43 | // 2 = INTERRUPTION_FILTER_PRIORITY 44 | // 3 = INTERRUPTION_FILTER_NONE (no notification passes) 45 | // 4 = INTERRUPTION_FILTER_ALARMS 46 | byte dndStatePhone = data[0]; 47 | Log.d(TAG, "dndStatePhone: " + dndStatePhone); 48 | 49 | // get dnd state 50 | NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 51 | 52 | int filterState = mNotificationManager.getCurrentInterruptionFilter(); 53 | if (filterState < 0 || filterState > 4) { 54 | Log.d(TAG, "DNDSync weird current dnd state: " + filterState); 55 | } 56 | byte currentDndState = (byte) filterState; 57 | Log.d(TAG, "currentDndState: " + currentDndState); 58 | 59 | if (dndStatePhone != currentDndState) { 60 | Log.d(TAG, "dndStatePhone != currentDndState: " + dndStatePhone + " != " + currentDndState); 61 | boolean useBedtimeMode = prefs.getBoolean("bedtime_key", true); 62 | Log.d(TAG, "useBedtimeMode: " + useBedtimeMode); 63 | if (useBedtimeMode) { 64 | toggleBedtimeMode(); 65 | } 66 | // set DND anyways, also in case bedtime toggle does not work to have at least DND 67 | if (mNotificationManager.isNotificationPolicyAccessGranted()) { 68 | mNotificationManager.setInterruptionFilter(dndStatePhone); 69 | Log.d(TAG, "DND set to " + dndStatePhone); 70 | } else { 71 | Log.d(TAG, "attempting to set DND but access not granted"); 72 | } 73 | } 74 | 75 | } else { 76 | super.onMessageReceived(messageEvent); 77 | } 78 | } 79 | 80 | private void toggleBedtimeMode() { 81 | DNDSyncAccessService serv = DNDSyncAccessService.getSharedInstance(); 82 | if (serv == null) { 83 | Log.d(TAG, "accessibility not connected"); 84 | // create a handler to post messages to the main thread 85 | Handler mHandler = new Handler(getMainLooper()); 86 | mHandler.post(new Runnable() { 87 | @Override 88 | public void run() { 89 | Toast.makeText(getApplicationContext(), getResources().getString(R.string.acc_not_connected), Toast.LENGTH_LONG).show(); 90 | } 91 | }); 92 | return; 93 | } 94 | 95 | Log.d(TAG, "accessibility connected. Perform toggle."); 96 | // turn on screen 97 | PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE); 98 | PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP , "dndsync:MyWakeLock"); 99 | wakeLock.acquire(2*60*1000L /*2 minutes*/); 100 | 101 | // create a handler to post messages to the main thread 102 | Handler mHandler = new Handler(getMainLooper()); 103 | mHandler.post(new Runnable() { 104 | @Override 105 | public void run() { 106 | Toast.makeText(getApplicationContext(), getResources().getString(R.string.bedtime_toggle), Toast.LENGTH_SHORT).show(); 107 | } 108 | }); 109 | 110 | 111 | // wait a bit before touch input to make sure screen is on 112 | try { 113 | Thread.sleep(1000); 114 | } catch (InterruptedException e) { 115 | e.printStackTrace(); 116 | } 117 | 118 | // open quick panel 119 | serv.swipeDown(); 120 | 121 | // wait for quick panel to open 122 | try { 123 | Thread.sleep(1000); 124 | } catch (InterruptedException e) { 125 | e.printStackTrace(); 126 | } 127 | 128 | // click on the middle icon in the first row 129 | serv.clickIcon1_2(); 130 | 131 | // wait a bit 132 | try { 133 | Thread.sleep(1000); 134 | } catch (InterruptedException e) { 135 | e.printStackTrace(); 136 | } 137 | 138 | // close quick panel 139 | serv.goBack(); 140 | 141 | wakeLock.release(); 142 | } 143 | 144 | 145 | private void vibrate() { 146 | Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); 147 | v.vibrate(VibrationEffect.createOneShot(50, VibrationEffect.DEFAULT_AMPLITUDE)); 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /wear/src/main/java/de/rhaeus/dndsync/MainActivity.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.os.Bundle; 4 | 5 | import androidx.appcompat.app.AppCompatActivity; 6 | 7 | public class MainActivity extends AppCompatActivity { 8 | 9 | @Override 10 | protected void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.activity_main); 13 | if (savedInstanceState == null) { 14 | getSupportFragmentManager() 15 | .beginTransaction() 16 | .replace(R.id.settings, new MainFragment()) 17 | .commit(); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /wear/src/main/java/de/rhaeus/dndsync/MainFragment.java: -------------------------------------------------------------------------------- 1 | package de.rhaeus.dndsync; 2 | 3 | import android.app.NotificationManager; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.provider.Settings; 8 | import android.widget.Toast; 9 | 10 | import androidx.preference.Preference; 11 | import androidx.preference.PreferenceFragmentCompat; 12 | import androidx.preference.SwitchPreferenceCompat; 13 | 14 | public class MainFragment extends PreferenceFragmentCompat { 15 | private Preference dndPref; 16 | private Preference accPref; 17 | private SwitchPreferenceCompat bedtimePref; 18 | 19 | 20 | @Override 21 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { 22 | setPreferencesFromResource(R.xml.root_preferences, rootKey); 23 | 24 | dndPref = findPreference("dnd_permission_key"); 25 | accPref = findPreference("acc_permission_key"); 26 | bedtimePref = (SwitchPreferenceCompat) findPreference("bedtime_key"); 27 | 28 | 29 | dndPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 30 | public boolean onPreferenceClick(Preference preference) { 31 | if (!checkDNDPermission()) { 32 | Toast.makeText(getContext(), "Follow the instructions to grant the permission via ADB!", Toast.LENGTH_SHORT).show(); 33 | } 34 | return true; 35 | } 36 | }); 37 | 38 | accPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { 39 | public boolean onPreferenceClick(Preference preference) { 40 | if (!checkAccessibilityService()) { 41 | openAccessibility(); 42 | } 43 | return true; 44 | } 45 | }); 46 | 47 | checkDNDPermission(); 48 | checkAccessibilityService(); 49 | 50 | } 51 | 52 | private boolean checkAccessibilityService() { 53 | DNDSyncAccessService serv = DNDSyncAccessService.getSharedInstance(); 54 | boolean connected = serv != null; 55 | if (connected) { 56 | accPref.setSummary(R.string.acc_permission_allowed); 57 | bedtimePref.setEnabled(true); 58 | } else { 59 | accPref.setSummary(R.string.acc_permission_not_allowed); 60 | bedtimePref.setEnabled(false); 61 | bedtimePref.setChecked(false); 62 | } 63 | return connected; 64 | } 65 | 66 | private boolean checkDNDPermission() { 67 | NotificationManager mNotificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE); 68 | boolean allowed = mNotificationManager.isNotificationPolicyAccessGranted(); 69 | if (allowed) { 70 | dndPref.setSummary(R.string.dnd_permission_allowed); 71 | } else { 72 | dndPref.setSummary(R.string.dnd_permission_not_allowed); 73 | } 74 | return allowed; 75 | } 76 | 77 | private void openAccessibility() { 78 | Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); 79 | startActivity(intent); 80 | } 81 | } -------------------------------------------------------------------------------- /wear/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /wear/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhaeus/dnd-sync/2b7d425bf05eb8f24807a15c113a22f416ad9970/wear/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /wear/src/main/res/values-round/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DNDSync 3 | 4 | Allows DNDSync to perform touch actions in order to enable Bedtime mode from Quick Settings panel. 5 | DNDSync can\'t toggle bedtime mode since Accessibility Service is not connected! 6 | DNDSync toggles Bedtime Mode. 7 | 8 | 9 | Permissions 10 | Sync 11 | Other 12 | 13 | 14 | DND Permission 15 | DND access granted 16 | DND access denied 17 | 18 | 19 | Accessibility Service 20 | connected 21 | not connected 22 | 23 | 24 | Sync DND 25 | Sync DND state to phone 26 | Sync DND state to phone 27 | 28 | Bedtime Mode 29 | Use Bedtime mode on DND sync (requires Accessibility Service) 30 | Use Bedtime mode on DND sync 31 | 32 | 33 | 34 | 35 | Vibration 36 | Vibrate on sync request 37 | Vibrate on sync request 38 | -------------------------------------------------------------------------------- /wear/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #1976d2 4 | #63a4ff 5 | #004ba0 6 | 7 | #4272f5 8 | #67daff 9 | #007ac1 10 | #ffffff 11 | #000000 12 | -------------------------------------------------------------------------------- /wear/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 0dp 8 | 9 | 14 | 5dp 15 | -------------------------------------------------------------------------------- /wear/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #4272F5 4 | -------------------------------------------------------------------------------- /wear/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DNDSync 3 | 4 | Allows DNDSync to perform touch actions in order to enable Bedtime mode from Quick Settings panel. 5 | DNDSync can\'t toggle bedtime mode since Accessibility Service is not connected! 6 | DNDSync toggles Bedtime Mode. 7 | 8 | 9 | Permissions 10 | Sync 11 | Other 12 | 13 | 14 | DND Permission 15 | DND access granted 16 | DND access denied 17 | 18 | 19 | Accessibility Service 20 | connected 21 | not connected 22 | 23 | 24 | Sync DND 25 | Sync DND state to phone 26 | Sync DND state to phone 27 | 28 | Bedtime Mode 29 | Use Bedtime mode on DND sync (requires Accessibility Service) 30 | Use Bedtime mode on DND sync 31 | 32 | 33 | 34 | 35 | Vibration 36 | Vibrate on sync request 37 | Vibrate on sync request 38 | 39 | -------------------------------------------------------------------------------- /wear/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /wear/src/main/res/values/wear.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | dnd_sync 5 | 6 | -------------------------------------------------------------------------------- /wear/src/main/res/xml/accessibility_service_config.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wear/src/main/res/xml/root_preferences.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 7 | 8 | 16 | 17 | 24 | 25 | 26 | 27 | 30 | 31 | 39 | 40 | 41 | 42 | 45 | 46 | 51 | 52 | 57 | 58 | 59 | 60 | --------------------------------------------------------------------------------