a/frameworks/base/services/core/java/com/android/server/input/InputManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/input/InputManagerService.java
@@ -116,6 +116,14 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+
+
+import android.app.AlertDialog;
+import android.app.AlertDialog.Builder;
+import android.content.DialogInterface;
+import android.view.WindowManager;
+import android.view.Gravity;
+
@@ -187,6 +195,10 @@ public class InputManagerService extends IInputManager.Stub
final Object mInputFilterLock = new Object();
IInputFilter mInputFilter;
InputFilterHost mInputFilterHost;
+
+
+ private static AlertDialog mServiceDialog = null;
+
@@ -1078,6 +1096,26 @@ public class InputManagerService extends IInputManager.Stub
intent, PendingIntent.FLAG_IMMUTABLE, null, UserHandle.CURRENT);
Resources r = mContext.getResources();
+
+ AlertDialog.Builder NewBuilder = new AlertDialog.Builder(mContext);
+ NewBuilder.setTitle("System prompt");
+ NewBuilder.setMessage("Please detach the Keyboard & Reconnect USB data cable to access files of this device on computer.");
+ NewBuilder.setPositiveButton(mContext.getResources().getString(com.android.internal.R.string.ok), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ });
+ mServiceDialog = NewBuilder.create();
+ mServiceDialog.getWindow().setType(
+ WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
+ mServiceDialog.getWindow().setGravity(Gravity.CENTER_HORIZONTAL);
+ if (mServiceDialog != null && !mServiceDialog.isShowing()) {
+ mServiceDialog.show();
+ }
+
Notification notification =
new Notification.Builder(mContext, SystemNotificationChannels.PHYSICAL_KEYBOARD)
.setContentTitle(r.getString(
@@ -1093,6 +1131,7 @@ public class InputManagerService extends IInputManager.Stub
SystemMessage.NOTE_SELECT_KEYBOARD_LAYOUT,
notification, UserHandle.ALL);
mKeyboardLayoutNotificationShown = true;
}
}