我要修改opl/etc/carrier里面xml文件的权限,下面是我的代码:
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;public class ChmodAdbShellActivity extends Activity implements OnClickListener {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
       Button button=(Button)findViewById(R.id.button);     
       button.setOnClickListener(this);
    } @Override
public void onClick(View v) {


runCommand("chmod 777 /opl/etc/carrier/dcd_config.xml");
Toast.makeText(this, "成功",1000).show();
}

public static boolean runCommand(String command) {  
    Process process = null;  
        try {  
            process = Runtime.getRuntime().exec(command);  
            Log.i("command","The Command is : "+command);  
            process.waitFor();  
        } catch (Exception e) {  
                Log.w("Exception ", "Unexpected error - "+e.getMessage());  
                return false;  
        } finally {  
                try {  
                        process.destroy();  
                } catch (Exception e) {  
                        Log.w("Exception ", "Unexpected error - "+e.getMessage());  
                }  
        }  
        return true;  

}下面是我在cmd里面的操作:C:\Users\cmcc>adb shell
# ls -l opl/etc/carrier
ls -l opl/etc/carrier
-rw-r--r-- root     root          810 2011-07-26 03:45 fetion_config.xml
-rw-r--r-- root     root          455 2011-07-26 03:45 dcd_config.xml
-rw-r--r-- root     root         1635 2011-07-26 03:45 mobilevideo_config.xml
-rwxrwxrwx root     root          258 2011-07-28 13:36 mobilemusic_config.xml
# ls -l opl/etc/carrier
ls -l opl/etc/carrier
-rw-r--r-- root     root          810 2011-07-26 03:45 fetion_config.xml
-rw-r--r-- root     root          455 2011-07-26 03:45 dcd_config.xml
-rw-r--r-- root     root         1635 2011-07-26 03:45 mobilevideo_config.xml
-rwxrwxrwx root     root          258 2011-07-28 13:36 mobilemusic_config.xml
#
可是修改不成功,请高手指点,谢谢!