Permalink
Browse files

Allow to disable qs footer warnings [1/2]

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 May 7, 2017
1 parent 3168c48 commit 6f4716565a01df77fd33edce5573915dc30922de
@@ -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.
@@ -64,6 +64,7 @@
private boolean mIsVisible;
private boolean mIsIconVisible;
private boolean mIsIcon2Visible;
private boolean mShowWarnings;
private int mFooterTextId;
private int mFooterIconId;
private int mFooterIcon2Id;
@@ -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);
}
};
@@ -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;
}
}
@@ -651,5 +651,8 @@ public void updateSettings() {
if (mCustomizePanel != null) {
mCustomizePanel.updateSettings();
}
if (mFooter != null) {
mFooter.updateSettings();
}
}
}
@@ -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();
}
@@ -738,6 +740,7 @@ public void update() {
mStatusBarWindowManager.updateKeyguardScreenRotation();
}
}
private OmniSettingsObserver mOmniSettingsObserver = new OmniSettingsObserver(mHandler);
private int mInteractingWindows;
private boolean mAutohideSuspended;

0 comments on commit 6f47165

Please sign in to comment.