ctl.start use

java:


                                Log.i(TAG,"set ctl.start ** logcpudisk");
                                SystemProperties.set("debug.btphone.dirname", newName);
                                SystemProperties.set("ctl.start", "logcpudisk");

                                String result = SystemProperties.get("debug.btphone.result","running");
                                Log.i(TAG,"debug.btphone.result: " + result);
                                int repeatCounter = 0;
                                while( !"ok".equals(result)){
                                    try{
                                        Thread.sleep(3000);
                                    }catch(Exception e){

                                    }
                                    repeatCounter += 3;

                                    if( repeatCounter > 60 ){

                                        mHandler.post(new Runnable() {
                                            @Override
                                            public void run() {
                                                ToastUtils.showMessage(mContext, "log file copy timeout");
                                            }
                                        });
                                        break;
                                     }

                                     result = SystemProperties.get("debug.btphone.result","running");

                                     Log.i(TAG,"debug.btphone.result: " + result);
                                 }

                                 if(repeatCounter < 60){

                                     Log.i(TAG,"*************");
                                     mHandler.post(new Runnable() {
                                        @Override

                                        public void run() {
                                            Toast.makeText(mContext, getString(R.string.log_msg_to_file, newName), Toast.LENGTH_LONG).show();
                                            //ToastUtils.showMessage(mContext, getString(R.string.log_msg_to_file, newName, Toast.LENGTH_LONG));
                                        }
                                     });

                                }


init.rc


service logcpudisk /system/xbin/cplog2u.sh
    user root
    group root
    oneshot


mk file:

 PRODUCT_COPY_FILES+= \
 
        device/panther_6dq/cplog2u.sh:system/xbin/cplog2u.sh  \



猜你喜欢

转载自blog.csdn.net/garycrescent/article/details/48344293