Skip to content

Commit

Permalink
Allow to disable qs footer warnings [1/2]
Browse files Browse the repository at this point in the history
When using apps like AdGuard that create a vpn, a warning is displayed
in the QS panel footer, so the user knows the device net is being monitored
by an external app.
The warning takes space and the user might want to avoid it if he already
knows that the app is running.

Change-Id: Ia1d3af670bf1fb5d4d2c7c50bd395c6fe0bd4a86
  • Loading branch information
ezio84 authored and xlxfoxxlx committed Jun 10, 2017
1 parent 3168c48 commit 6f47165
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Expand Up @@ -4344,6 +4344,12 @@ public boolean validate(String value) {
*/
public static final String DND_WHEN_CALL = "dnd_when_call";

/**
* Whether to show QS footer warnings
* @hide
*/
public static final String QS_FOOTER_WARNINGS = "qs_footer_warnings";

/**
* Settings to backup. This is here so that it's in the same place as the settings
* keys and easy to update.
Expand Down
13 changes: 10 additions & 3 deletions packages/SystemUI/src/com/android/systemui/qs/QSFooter.java
Expand Up @@ -64,6 +64,7 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
private boolean mIsVisible;
private boolean mIsIconVisible;
private boolean mIsIcon2Visible;
private boolean mShowWarnings;
private int mFooterTextId;
private int mFooterIconId;
private int mFooterIcon2Id;
Expand Down Expand Up @@ -289,9 +290,9 @@ public void run() {
if (mFooterTextId != 0) {
mFooterText.setText(mFooterTextId);
}
mRootView.setVisibility(mIsVisible ? View.VISIBLE : View.GONE);
mFooterIcon.setVisibility(mIsIconVisible ? View.VISIBLE : View.INVISIBLE);
mFooterIcon2.setVisibility(mIsIcon2Visible ? View.VISIBLE : View.INVISIBLE);
mRootView.setVisibility((mIsVisible && mShowWarnings) ? View.VISIBLE : View.GONE);
mFooterIcon.setVisibility((mIsIconVisible && mShowWarnings) ? View.VISIBLE : View.INVISIBLE);
mFooterIcon2.setVisibility((mIsIcon2Visible && mShowWarnings) ? View.VISIBLE : View.INVISIBLE);
}
};

Expand Down Expand Up @@ -338,4 +339,10 @@ public void onClick(View widget) {
mContext.startActivity(intent);
}
}

public void updateSettings() {
mShowWarnings = Settings.System.getIntForUser(
mContext.getContentResolver(), Settings.System.QS_FOOTER_WARNINGS, 1,
UserHandle.USER_CURRENT) == 1;
}
}
3 changes: 3 additions & 0 deletions packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
Expand Up @@ -651,5 +651,8 @@ public void updateSettings() {
if (mCustomizePanel != null) {
mCustomizePanel.updateSettings();
}
if (mFooter != null) {
mFooter.updateSettings();
}
}
}
Expand Up @@ -725,7 +725,9 @@ void observe() {
mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(
Settings.System.ACCELEROMETER_ROTATION),
false, this, UserHandle.USER_ALL);

mContext.getContentResolver().registerContentObserver(Settings.System.getUriFor(
Settings.System.QS_FOOTER_WARNINGS),
false, this, UserHandle.USER_ALL);
update();
}

Expand All @@ -738,6 +740,7 @@ public void update() {
mStatusBarWindowManager.updateKeyguardScreenRotation();
}
}

private OmniSettingsObserver mOmniSettingsObserver = new OmniSettingsObserver(mHandler);
private int mInteractingWindows;
private boolean mAutohideSuspended;
Expand Down

0 comments on commit 6f47165

Please sign in to comment.