diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 37678dd425122..5b917cc4fdf17 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -3614,7 +3614,7 @@
USB port is automatically disabled. Tap to learn more.
- Safe to use USB port
+ OK to use USB port
Phone no longer detects liquid or debris.
diff --git a/packages/SystemUI/res/layout/contaminant_dialog.xml b/packages/SystemUI/res/layout/contaminant_dialog.xml
new file mode 100644
index 0000000000000..ea6d900e8fa7f
--- /dev/null
+++ b/packages/SystemUI/res/layout/contaminant_dialog.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index fcf1b5e859141..98312505b80d2 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -166,7 +166,7 @@
USB port disabled
- To protect your device from liquid or debris, the USB port is disabled and won\u2019t detect any accessories.\n\nYou\u2019ll be notified when it\u2019s safe to use the USB port again.
+ To protect your device from liquid or debris, the USB port is disabled and won\u2019t detect any accessories.\n\nYou\u2019ll be notified when it\u2019s okay to use the USB port again.
USB port enabled to detect chargers and accessories
@@ -174,6 +174,9 @@
Enable USB
+
+ Learn more
+
Zoom to fill screen
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 59ed5cea21692..04cd30cdb86ac 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -572,4 +572,22 @@
- true
- true
+
+
+
+
+
diff --git a/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java b/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
index ecf608beb91cd..aec14be9c39ea 100644
--- a/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/usb/UsbContaminantActivity.java
@@ -16,30 +16,33 @@
package com.android.systemui.usb;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
+import android.app.Activity;
import android.content.Intent;
import android.hardware.usb.ParcelableUsbPort;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbPort;
import android.os.Bundle;
import android.util.Log;
+import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.widget.TextView;
import android.widget.Toast;
-import com.android.internal.app.AlertActivity;
-import com.android.internal.app.AlertController;
import com.android.systemui.R;
/**
* Activity that alerts the user when contaminant is detected on USB port.
*/
-public class UsbContaminantActivity extends AlertActivity
- implements DialogInterface.OnClickListener {
+public class UsbContaminantActivity extends Activity implements View.OnClickListener {
private static final String TAG = "UsbContaminantActivity";
private UsbPort mUsbPort;
+ private TextView mLearnMore;
+ private TextView mGotIt;
+ private TextView mEnableUsb;
+ private TextView mTitle;
+ private TextView mMessage;
@Override
public void onCreate(Bundle icicle) {
@@ -47,22 +50,30 @@ public class UsbContaminantActivity extends AlertActivity
window.addSystemFlags(WindowManager.LayoutParams
.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
window.setType(WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(icicle);
+ setContentView(R.layout.contaminant_dialog);
Intent intent = getIntent();
ParcelableUsbPort port = intent.getParcelableExtra(UsbManager.EXTRA_PORT);
mUsbPort = port.getUsbPort(getSystemService(UsbManager.class));
- final AlertController.AlertParams ap = mAlertParams;
- ap.mTitle = getString(R.string.usb_contaminant_title);
- ap.mMessage = getString(R.string.usb_contaminant_message);
- ap.mNegativeButtonText = getString(android.R.string.ok);
- ap.mNeutralButtonText = getString(R.string.usb_disable_contaminant_detection);
- ap.mNegativeButtonListener = this;
- ap.mNeutralButtonListener = this;
+ mLearnMore = findViewById(R.id.learnMore);
+ mEnableUsb = findViewById(R.id.enableUsb);
+ mGotIt = findViewById(R.id.gotIt);
+ mTitle = findViewById(R.id.title);
+ mMessage = findViewById(R.id.message);
- setupAlert();
+ mTitle.setText(getString(R.string.usb_contaminant_title));
+ mMessage.setText(getString(R.string.usb_contaminant_message));
+ mEnableUsb.setText(getString(R.string.usb_disable_contaminant_detection));
+ mGotIt.setText(getString(R.string.got_it));
+ mLearnMore.setText(getString(R.string.learn_more));
+
+ mEnableUsb.setOnClickListener(this);
+ mGotIt.setOnClickListener(this);
+ mLearnMore.setOnClickListener(this);
}
@Override
@@ -71,8 +82,8 @@ public class UsbContaminantActivity extends AlertActivity
}
@Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == AlertDialog.BUTTON_NEUTRAL) {
+ public void onClick(View v) {
+ if (v == mEnableUsb) {
try {
mUsbPort.enableContaminantDetection(false);
Toast.makeText(this, R.string.usb_port_enabled,
@@ -80,6 +91,13 @@ public class UsbContaminantActivity extends AlertActivity
} catch (Exception e) {
Log.e(TAG, "Unable to notify Usb service", e);
}
+ } else if (v == mLearnMore) {
+ final Intent intent = new Intent();
+ intent.setClassName("com.android.settings",
+ "com.android.settings.HelpTrampoline");
+ intent.putExtra(Intent.EXTRA_TEXT,
+ "help_url_usb_contaminant_detected");
+ startActivity(intent);
}
finish();
}