public static void unhide(Context ctx, List<ActionResult> lista, JSONObject options) {
    PreyLogger.i("started unhide");
    PreyWebServices.getInstance()
        .sendNotifyActionResultPreyHttp(
            ctx, UtilJson.makeMapParam("stop", "camouflage", "stopped"));
    PreyConfig.getPreyConfig(ctx).setCamouflageSet(false);

    ComponentName componentToEnabled =
        new ComponentName("com.prey", "com.prey.activities.LoginActivity");
    PackageManager pm = ctx.getApplicationContext().getPackageManager();
    pm.setComponentEnabledSetting(
        componentToEnabled,
        PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
        PackageManager.DONT_KILL_APP);
    PreyLogger.i("stopped unhide");
    PreyConfig.getPreyConfig(ctx).setLastEvent("camouflage_unhide");
  }
Esempio n. 2
0
  public static void hide(Context ctx, List<ActionResult> lista, JSONObject parameters) {
    PreyLogger.i("started hide");
    String messageId = null;
    try {
      messageId = parameters.getString(PreyConfig.MESSAGE_ID);
    } catch (Exception e) {
    }
    PreyWebServices.getInstance()
        .sendNotifyActionResultPreyHttp(
            ctx, UtilJson.makeMapParam("start", "camouflage", "started", null));
    PreyConfig.getPreyConfig(ctx).setCamouflageSet(true);

    ComponentName componentToDisabled =
        new ComponentName("com.prey", "com.prey.activities.LoginActivity");
    PackageManager pm = ctx.getPackageManager();
    pm.setComponentEnabledSetting(
        componentToDisabled,
        PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
        PackageManager.DONT_KILL_APP);
    PreyLogger.i("stopped hide");
    PreyConfig.getPreyConfig(ctx).setLastEvent("camouflage_hide");
  }