添加新的键盘apk并设置为默认键盘

来源:互联网 发布:淘宝衣服尺码对照表 编辑:程序博客网 时间:2024/05/01 03:00

1.将新的键盘apk push到system/app

2.修改com.android.provision包中的DdfaultActivity.java文件

private void settingLargeSysFont() {
        try {
           Configuration mCurConfig = new Configuration();
            try {
               mCurConfig.updateFrom(ActivityManagerNative.getDefault().getConfiguration());
                   } catch (RemoteException re) {
               /* ignore */
            }
            int i = SystemProperties.getInt("ro.default.size",100);
        mCurConfig.fontScale=(i*0.01f);
            ActivityManagerNative.getDefault().updatePersistentConfiguration(mCurConfig);
                   } catch (RemoteException re) {
            /* ignore */
            }

//lsd add
        //InputMethodManager mImm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        IInputMethodManager mImm = IInputMethodManager.Stub.asInterface(ServiceManager.getService("input_method"));
        String temp1= "com.x2android.ArabicSKeyboard/.ArabicSoftKeyboard";
        //String temp2 = "com.googlecode.tcimeforpk/.ZhuyinIME";
        try{
            if(isInputMethodlist(temp1))
            {
                mImm.setInputMethodEnabled(temp1, true);
                mImm.setInputMethodAndSubtype(null ,temp1, null);
            }
            /*
            if(isInputMethodlist(temp2))
                mImm.setInputMethodEnabled(temp2, true);

           */
                }
        catch (RemoteException e) {
            System.err.println(e.toString());
            return;
        }
        //mImm.setInputMethodEnabled(temp, true);
        //android.util.Log.d("lsd", temp);
    }

原创粉丝点击