Skip to content

Commit fb229da

Browse files
committed
Initial commit
0 parents  commit fb229da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1137
-0
lines changed

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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

.idea/.gitignore

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Connor Lanigan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
![](/app/src/main/res/mipmap-xhdpi/ic_launcher.png)
2+
3+
# Ambient Display Auto Toggle for Android
4+
5+
An Android app that turns off Ambient Display (also called "Always On Display") while the device is
6+
charging, so that it doesn't light up the room at night.
7+
8+
You can toggle Ambient Display manually in the Android system settings under
9+
_Display_ > _Lock screen_ > _Always show time and info_. This app automates that switch.
10+
11+
## Installing & setup
12+
13+
This app requires Android 9 or higher.
14+
15+
Download the APK
16+
from [the GitHub release page](https://github.com/connorlanigan/ambient-display-auto-toggle/releases)
17+
onto your device. You might have to enable "Installing from unknown sources" to install the APK.
18+
19+
Since the app needs a special permission to be able to control the Always On setting, you need to
20+
grant this permission manually from a PC. Follow these steps:
21+
22+
- Enable ADB debugging on your
23+
device ([instructions](https://developer.android.com/studio/command-line/adb#Enabling))
24+
- Connect your device to a computer which has the ADB command-line installed
25+
- Run the following command on the computer:
26+
`adb shell pm grant com.connorlanigan.ambientdisplayautotoggle android.permission.WRITE_SECURE_SETTINGS`
27+
- Launch the app at least once
28+
29+
When you connect your phone to a charger, the Android system will notify this app, and the app will
30+
turn off the Ambient Display feature. When you disconnect the charger, the app will be notified
31+
again, and will turn on the Ambient Display feature again.
32+
33+
## Hiding the persistent notification
34+
35+
By default, the app shows a persistent silent notification in your notification bar. This
36+
notification is required by Android for allowing the app to continue receiving events about the
37+
charging status in the background. You can safely hide the notification if you want. To do this:
38+
39+
1. Find the persistent notification in your notification shade
40+
1. Tap and hold the notification, until more options appear
41+
1. Tap _"Turn off notifications"_ in the bottom left
42+
1. Tap on _"App is running in the background"_ to switch the notification off
43+
1. Tap _"Apply"_
44+
45+
The app will continue running in the background. It will not consume any energy though, since it
46+
only acts when the Android system notifies it that a charger has been connected/disconnected.
47+
48+
## License
49+
50+
MIT License
51+
52+
Copyright (c) 2022 Connor Lanigan
53+
54+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
55+
associated documentation files (the "Software"), to deal in the Software without restriction,
56+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
57+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
58+
furnished to do so, subject to the following conditions:
59+
60+
The above copyright notice and this permission notice shall be included in all copies or substantial
61+
portions of the Software.
62+
63+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
64+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
66+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
67+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/build
2+
/release

app/build.gradle

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'com.google.android.gms.oss-licenses-plugin'
5+
}
6+
7+
android {
8+
compileSdk 32
9+
10+
defaultConfig {
11+
applicationId "com.connorlanigan.ambientdisplayautotoggle"
12+
minSdk 28
13+
targetSdk 32
14+
versionCode 1
15+
versionName "1.0"
16+
17+
vectorDrawables {
18+
useSupportLibrary true
19+
}
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26+
}
27+
debug {
28+
applicationIdSuffix ".debug"
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility JavaVersion.VERSION_1_8
33+
targetCompatibility JavaVersion.VERSION_1_8
34+
}
35+
kotlinOptions {
36+
jvmTarget = '1.8'
37+
}
38+
buildFeatures {
39+
compose true
40+
}
41+
composeOptions {
42+
kotlinCompilerExtensionVersion compose_version
43+
}
44+
packagingOptions {
45+
resources {
46+
excludes += '/META-INF/{AL2.0,LGPL2.1}'
47+
}
48+
}
49+
}
50+
51+
dependencies {
52+
53+
implementation 'androidx.core:core-ktx:1.8.0'
54+
implementation "androidx.compose.ui:ui:$compose_version"
55+
implementation "androidx.compose.material:material:$compose_version"
56+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.1'
57+
implementation 'androidx.activity:activity-compose:1.4.0'
58+
implementation 'androidx.datastore:datastore-preferences:1.0.0'
59+
60+
// This library shows a license screen for third-party dependencies.
61+
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
62+
63+
// This library is needed to supply the theme for the license screen.
64+
implementation 'androidx.appcompat:appcompat:1.4.2'
65+
66+
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
67+
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
68+
}

0 commit comments

Comments
 (0)