Skip to content

Commit

Permalink
MainService: persist EXTRA_FALLBACK_SCREEN_CAPTURE unconditionally
Browse files Browse the repository at this point in the history
Letting this depend on view-only being false is not correct as
start-on-boot requires InputService as well. The original idea was
that when view-only was false, InputService would be setup. But this
is flawed anyway as the user might still not setup InputService even
if view-only is false.

Instead, simply persist it and let later logic handle InputService being
there or not.

Fixes a bug where a correctly setup start-on-boot with InputService but
view-only true would run into getting stuck in a dialog.
  • Loading branch information
bk138 committed Sep 27, 2024
1 parent 168048b commit 19af96f
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,7 @@ public int onStartCommand(Intent intent, int flags, int startId)
ed.putBoolean(PREFS_KEY_SERVER_LAST_SHOW_POINTERS,
!intent.getBooleanExtra(EXTRA_VIEW_ONLY, prefs.getBoolean(Constants.PREFS_KEY_SETTINGS_VIEW_ONLY, mDefaults.getViewOnly()))
&& intent.getBooleanExtra(EXTRA_SHOW_POINTERS, prefs.getBoolean(Constants.PREFS_KEY_SETTINGS_SHOW_POINTERS, mDefaults.getShowPointers())));
// using fallback screen capture depends on view-only being false
ed.putBoolean(PREFS_KEY_SERVER_LAST_FALLBACK_SCREEN_CAPTURE,
!intent.getBooleanExtra(EXTRA_VIEW_ONLY, prefs.getBoolean(Constants.PREFS_KEY_SETTINGS_VIEW_ONLY, mDefaults.getViewOnly()))
&& intent.getBooleanExtra(EXTRA_FALLBACK_SCREEN_CAPTURE, false));
ed.putBoolean(PREFS_KEY_SERVER_LAST_FALLBACK_SCREEN_CAPTURE, intent.getBooleanExtra(EXTRA_FALLBACK_SCREEN_CAPTURE, false));
ed.apply();
// also set new value for InputService
InputService.scaling = PreferenceManager.getDefaultSharedPreferences(this).getFloat(Constants.PREFS_KEY_SERVER_LAST_SCALING, new Defaults(this).getScaling());
Expand Down

0 comments on commit 19af96f

Please sign in to comment.