【Android系统源码修改】OTG U盘插入后,直接弹出指定APP

需修改 vendor/mediatek/proprietary/frameworks/base/storage/java/com/mediatek/storage/StorageDefaultPathDialog.java
在创建对话框之前,调用指定APP,并注释对话框的生成(此对话框是询问用户是否切换默认存储器)

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG,"StorageDefaultPathDialog onCreate()");
        mSDCardStateFilter = new IntentFilter(SD_ACTION);
        mSDCardStateFilter.addDataScheme("file");
        mReceiver = mSDStateReceiver;
        mInsertOtg = getIntent().getBooleanExtra(INSERT_OTG, false);
//        createDialog();
          /** 添加: 打开指定APP */
        PackageManager manager = getPackageManager();
        Intent intent = manager.getLaunchIntentForPackage("com.yongyida.robot.videotutarial");
        if (intent != null) {
            try {
                startActivity(intent);
            } catch (Exception e) {
                Log.d(TAG, "Exception:" + e.getMessage());
            }
        }
        finish();
    }

你可能感兴趣的:(Android系统源码修改)