mDaemonStrategy = new DaemonStrategyUnder21(); }else{ mDaemonStrategy = new DaemonStrategy21(); mDaemonStrategy = new DaemonStrategyXiaomi(); }else if(Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("a31")){ mDaemonStrategy = new DaemonStrategy21(); }else{ mDaemonStrategy = new DaemonStrategyUnder21();
private boolean initIndicators(Context context){ File dirFile = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); if(!dirFile.exists()){ dirFile.mkdirs(); } try { createNewFile(dirFile, INDICATOR_PERSISTENT_FILENAME); createNewFile(dirFile, INDICATOR_DAEMON_ASSISTANT_FILENAME); return true; } catch (IOException e) { e.printStackTrace(); return false; } }
@Override public void onPersistentCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.DAEMON_ASSISTANT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ @Override public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath()); } }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onPersistentStart(context); } }
@Override public boolean onInitialization(Context context) { return initIndicators(context); }
@Override public boolean onInitialization(Context context) { return initIndicators(context); }
@Override public void onDaemonAssistantCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.PERSISTENT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath()); }; }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onDaemonAssistantStart(context); } }
@Override public boolean onInitialization(Context context) { return initIndicators(context); }
private boolean initIndicators(Context context){ File dirFile = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); if(!dirFile.exists()){ dirFile.mkdirs(); } try { createNewFile(dirFile, INDICATOR_PERSISTENT_FILENAME); createNewFile(dirFile, INDICATOR_DAEMON_ASSISTANT_FILENAME); return true; } catch (IOException e) { e.printStackTrace(); return false; } }
mDaemonStrategy = new DaemonStrategyUnder21(); }else{ mDaemonStrategy = new DaemonStrategy21(); mDaemonStrategy = new DaemonStrategyXiaomi(); }else if(Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("a31")){ mDaemonStrategy = new DaemonStrategy21(); }else{ mDaemonStrategy = new DaemonStrategyUnder21();
@Override public void onDaemonAssistantCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.PERSISTENT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath()); }; }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onDaemonAssistantStart(context); } }
private boolean initIndicators(Context context){ File dirFile = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); if(!dirFile.exists()){ dirFile.mkdirs(); } try { createNewFile(dirFile, INDICATOR_PERSISTENT_FILENAME); createNewFile(dirFile, INDICATOR_DAEMON_ASSISTANT_FILENAME); return true; } catch (IOException e) { e.printStackTrace(); return false; } }
mDaemonStrategy = new DaemonStrategyUnder21(); }else{ mDaemonStrategy = new DaemonStrategy21(); mDaemonStrategy = new DaemonStrategyXiaomi(); }else if(Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("a31")){ mDaemonStrategy = new DaemonStrategy21(); }else{ mDaemonStrategy = new DaemonStrategyUnder21();
@Override public void onPersistentCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.DAEMON_ASSISTANT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ @Override public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath()); } }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onPersistentStart(context); } }
@Override public void onPersistentCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.DAEMON_ASSISTANT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ @Override public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath()); } }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onPersistentStart(context); } }
@Override public void onDaemonAssistantCreate(final Context context, DaemonConfigurations configs) { Intent intent = new Intent(); ComponentName componentName = new ComponentName(context.getPackageName(), configs.PERSISTENT_CONFIG.SERVICE_NAME); intent.setComponent(componentName); context.startService(intent); initAlarm(context, configs.PERSISTENT_CONFIG.SERVICE_NAME); Thread t = new Thread(){ public void run() { File indicatorDir = context.getDir(INDICATOR_DIR_NAME, Context.MODE_PRIVATE); new NativeDaemonAPI21(context).doDaemon( new File(indicatorDir, INDICATOR_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, INDICATOR_PERSISTENT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_DAEMON_ASSISTANT_FILENAME).getAbsolutePath(), new File(indicatorDir, OBSERVER_PERSISTENT_FILENAME).getAbsolutePath()); }; }; t.setPriority(Thread.MAX_PRIORITY); t.start(); if(configs != null && configs.LISTENER != null){ this.mConfigs = configs; configs.LISTENER.onDaemonAssistantStart(context); } }