--- a/android/frameworks/base/core/res/res/values/config.xml
+++ b/android/frameworks/base/core/res/res/values/config.xml
@@ -2502,7 +2502,7 @@
<!-- If true, then we do not ask user for permission for apps to connect to USB devices.
Do not set this to true for production devices. Doing so will cause you to fail CTS. -->
- <bool name="config_disableUsbPermissionDialogs">false</bool>
+ <bool name="config_disableUsbPermissionDialogs">true</bool>
<!-- Activity to handle Usb Device connection in USB Host side. Keeping it to null value will
lead into handling it inside system using Intent resolution. Non-null contents will have
全志Android 10? 默认USB 音频打开
/*
private void chooseUsbAudioDeviceDialog(final ArrayList<String> usb_device)
{ //sam jiang loged
String str = mCtx.getResources().getString(com.android.internal.R.string.usb_output_message);
alertDialog = new AlertDialog.Builder(mCtx).
setTitle(com.android.internal.R.string.usb_output_title).
setMessage(String.format(str, Integer.toString(USB_TOAST_TIME))).
setPositiveButton(com.android.internal.R.string.usb_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
String message = mCtx.getResources().getString(R.string.usb_audio_plug_in_message);
toastPlugInNotification(message, AUDIO_OUT_NOTIFY);
mAudioManagerEx.setAudioDeviceActive(usb_device, AudioManagerEx.AUDIO_OUTPUT_ACTIVE);
}
}).
setNegativeButton(com.android.internal.R.string.usb_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//Log.v(TAG, "setNegativeButton ");
String message = mCtx.getResources().getString(R.string.usb_audio_plug_out_message);
toastPlugInNotification(message, AUDIO_OUT_NOTIFY);
}
}).
create();
alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
alertDialog.show();
new AsyncTask() {
@Override
protected Object doInBackground(Object... arg0) {
int time = USB_TOAST_TIME;
while(time >= 0 && alertDialog != null && alertDialog.isShowing()){
publishProgress(time);
try {
Thread.sleep(1000);
} catch(Exception e) {
// do nothing
}
time--;
}
return null;
}
@Override
protected void onPostExecute(Object result) {
super.onPostExecute(result);
if (alertDialog != null && alertDialog.isShowing()) {
alertDialog.dismiss();
mAudioManagerEx.setAudioDeviceActive(usb_device, AudioManagerEx.AUDIO_OUTPUT_ACTIVE);
alertDialog = null;
}
}
@Override
protected void onProgressUpdate(Object... values) {
super.onProgressUpdate(values);
int time = (Integer)values[0];
String str = mCtx.getResources().getString(com.android.internal.R.string.usb_output_message);
if(alertDialog != null)
alertDialog.setMessage(String.format(str, Integer.toString(time)));
}
}.execute();
}
*/
private void chooseUsbAudioDeviceDialog(final ArrayList<String> usb_device)
{ //loged
String message = mCtx.getResources().getString(R.string.usb_audio_plug_in_message);
toastPlugInNotification(message, AUDIO_OUT_NOTIFY);
mAudioManagerEx.setAudioDeviceActive(usb_device, AudioManagerEx.AUDIO_OUTPUT_ACTIVE); //起作用的是这一句
}
|