Skip to content

Commit

Permalink
Merge pull request #140 from SanojPunchihewa/bug-fixes
Browse files Browse the repository at this point in the history
Fix app crash when settings write permission not given
  • Loading branch information
SanojPunchihewa authored Mar 20, 2020
2 parents 9ce80cf + 5b7db44 commit 7c33c70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {
window = getWindow();

try {
Settings.System.putInt(cResolver,
Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
//Get the current system brightness
int brightness = Settings.System.getInt(cResolver, Settings.System.SCREEN_BRIGHTNESS);
PreferenceUtil.setSharedPreferenceInt(R.string.id_screen_brightness, brightness);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public static void changeBrightness(ContentResolver cResolver, Window window, in
}

if (settingsCanWrite) {
Settings.System.putInt(cResolver,
Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
//Set the system brightness using the brightness variable value
Settings.System.putInt(cResolver, Settings.System.SCREEN_BRIGHTNESS, value);
//Get the current window attributes
Expand Down

0 comments on commit 7c33c70

Please sign in to comment.