Fields Summary |
---|
protected static final String | TAG |
protected static final boolean | DEBUG |
private final android.view.View | mRootView |
private final android.widget.TextView | mFooterText |
private final android.widget.ImageView | mFooterIcon |
private final android.content.Context | mContext |
private final Callback | mCallback |
private com.android.systemui.statusbar.policy.SecurityController | mSecurityController |
private android.app.AlertDialog | mDialog |
private com.android.systemui.statusbar.phone.QSTileHost | mHost |
private android.os.Handler | mHandler |
private final android.os.Handler | mMainHandler |
private boolean | mIsVisible |
private boolean | mIsIconVisible |
private int | mFooterTextId |
private final Runnable | mUpdateDisplayState |
Methods Summary |
---|
private void | createDialog()
mDialog = new SystemUIDialog(mContext);
mDialog.setTitle(getTitle());
mDialog.setMessage(getMessage());
mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(), this);
if (mSecurityController.isVpnEnabled()) {
mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getNegativeButton(), this);
}
mDialog.show();
|
private java.lang.String | getMessage()
if (mSecurityController.hasDeviceOwner()) {
if (mSecurityController.hasProfileOwner()) {
if (mSecurityController.isVpnEnabled()) {
if (mSecurityController.isLegacyVpn()) {
return mContext.getString(
R.string.monitoring_description_legacy_vpn_device_and_profile_owned,
mSecurityController.getDeviceOwnerName(),
mSecurityController.getProfileOwnerName(),
mSecurityController.getLegacyVpnName());
} else {
return mContext.getString(
R.string.monitoring_description_vpn_device_and_profile_owned,
mSecurityController.getDeviceOwnerName(),
mSecurityController.getProfileOwnerName(),
mSecurityController.getVpnApp());
}
} else {
return mContext.getString(
R.string.monitoring_description_device_and_profile_owned,
mSecurityController.getDeviceOwnerName(),
mSecurityController.getProfileOwnerName());
}
} else {
if (mSecurityController.isVpnEnabled()) {
if (mSecurityController.isLegacyVpn()) {
return mContext.getString(
R.string.monitoring_description_legacy_vpn_device_owned,
mSecurityController.getDeviceOwnerName(),
mSecurityController.getLegacyVpnName());
} else {
return mContext.getString(R.string.monitoring_description_vpn_device_owned,
mSecurityController.getDeviceOwnerName(),
mSecurityController.getVpnApp());
}
} else {
return mContext.getString(R.string.monitoring_description_device_owned,
mSecurityController.getDeviceOwnerName());
}
}
} else if (mSecurityController.hasProfileOwner()) {
if (mSecurityController.isVpnEnabled()) {
if (mSecurityController.isLegacyVpn()) {
return mContext.getString(
R.string.monitoring_description_legacy_vpn_profile_owned,
mSecurityController.getProfileOwnerName(),
mSecurityController.getLegacyVpnName());
} else {
return mContext.getString(
R.string.monitoring_description_vpn_profile_owned,
mSecurityController.getProfileOwnerName(),
mSecurityController.getVpnApp());
}
} else {
return mContext.getString(
R.string.monitoring_description_profile_owned,
mSecurityController.getProfileOwnerName());
}
} else {
if (mSecurityController.isLegacyVpn()) {
return mContext.getString(R.string.monitoring_description_legacy_vpn,
mSecurityController.getLegacyVpnName());
} else {
return mContext.getString(R.string.monitoring_description_vpn,
mSecurityController.getVpnApp());
}
}
|
private java.lang.String | getNegativeButton()
if (mSecurityController.isLegacyVpn()) {
return mContext.getString(R.string.disconnect_vpn);
} else {
return mContext.getString(R.string.disable_vpn);
}
|
private java.lang.String | getPositiveButton()
return mContext.getString(R.string.quick_settings_done);
|
private int | getTitle()
if (mSecurityController.hasDeviceOwner()) {
return R.string.monitoring_title_device_owned;
}
if (mSecurityController.hasProfileOwner()) {
return R.string.monitoring_title_profile_owned;
}
return R.string.monitoring_title;
|
public android.view.View | getView()
return mRootView;
|
private void | handleClick()
mHost.collapsePanels();
// TODO: Delay dialog creation until after panels are collapsed.
createDialog();
|
private void | handleRefreshState()
if (mSecurityController.hasDeviceOwner()) {
mFooterTextId = R.string.device_owned_footer;
mIsVisible = true;
mIsIconVisible = false;
} else if (mSecurityController.hasProfileOwner()) {
mFooterTextId = R.string.profile_owned_footer;
mIsVisible = true;
mIsIconVisible = false;
} else if (mSecurityController.isVpnEnabled()) {
mFooterTextId = R.string.vpn_footer;
mIsVisible = true;
mIsIconVisible = true;
} else {
mIsVisible = false;
mIsIconVisible = false;
}
mMainHandler.post(mUpdateDisplayState);
|
public boolean | hasFooter()
return mRootView.getVisibility() != View.GONE;
|
public void | onClick(android.content.DialogInterface dialog, int which)
if (which == DialogInterface.BUTTON_NEGATIVE) {
mSecurityController.disconnectFromVpn();
}
|
public void | onClick(android.view.View v)
mHandler.sendEmptyMessage(H.CLICK);
|
public void | onConfigurationChanged()
FontSizeUtils.updateFontSize(mFooterText, R.dimen.qs_tile_text_size);
|
public void | refreshState()
mHandler.sendEmptyMessage(H.REFRESH_STATE);
|
public void | setHost(com.android.systemui.statusbar.phone.QSTileHost host)
mHost = host;
mSecurityController = host.getSecurityController();
mHandler = new H(host.getLooper());
|
public void | setListening(boolean listening)
if (listening) {
mSecurityController.addCallback(mCallback);
} else {
mSecurityController.removeCallback(mCallback);
}
|