public void log(String msg, int i) { Log.d(TAG, msg); try { mLogWriter.print(msg); } catch (IOException e) { // TODO Auto-generated catch block Log.d(TAG, e.getMessage()); } }
@Override public void onCreate() { super.onCreate(); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "My Tag"); mWakeLock.acquire(); File logf = new File(Environment.getExternalStorageDirectory() + File.separator + "DemoLog.txt"); try { mLogWriter = LogWriter.open(logf.getAbsolutePath()); } catch (IOException e) { // TODO Auto-generatedo catch block log(e.getMessage()); } log("onCreate()"); // 测试杀掉teamview再打开功能 try { Runtime.getRuntime().exec(new String[] {"/system/bin/su", "-c", "ls -al"}); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (!isAppInstalled(WatchService.this, paName)) { Log.d("DemoLog", "no install"); ApkController apkController = new ApkController(WatchService.this); apkController.install(); handler.removeMessages(UPDATE_BEGIN_ZHUANGTAI); handler.sendEmptyMessage(UPDATE_BEGIN_ZHUANGTAI); } else { try { startTeamView(); } catch (Exception e) { } } // 亮度调节 settingUtils = new SettingUtils(WatchService.this); settingUtils.setBrightness(0); }