@DSVerified
  @DSBan(DSCat.DROIDSAFE_INTERNAL)
  public static void modelBroadCastReceiver(BroadcastReceiver receiver) {
    if (mApplication != null) {
      receiver.setApplication(mApplication);
      // callback receiver
      if (receiver instanceof android.app.admin.DeviceAdminReceiver) {
        DeviceAdminReceiver ar = (DeviceAdminReceiver) receiver;
        Intent appIntent = mApplication.droidsafeGetIntent();
        ar.onDisableRequested(context, appIntent);
        ar.onDisabled(context, appIntent);
        ar.onEnabled(context, appIntent);
        ar.onPasswordChanged(context, appIntent);
        ar.onPasswordExpiring(context, appIntent);
        ar.onPasswordFailed(context, appIntent);
        ar.onPasswordSucceeded(context, appIntent);
      }

      if (receiver instanceof android.appwidget.AppWidgetProvider) {
        AppWidgetProvider aw = (AppWidgetProvider) receiver;
        Intent appIntent = mApplication.droidsafeGetIntent();
        aw.onReceive(context, appIntent);
        aw.onEnabled(context);
        aw.onDisabled(context);
        int[] appWidgetIds = new int[1];
        appWidgetIds[0] = DSUtils.FAKE_INT;
        aw.onUpdate(context, AppWidgetManager.getInstance(context), appWidgetIds);
        aw.onDeleted(context, appWidgetIds);
      }
    }
  }
示例#2
0
  @Override
  public void onPasswordFailed(Context context, Intent intent) {
    super.onPasswordFailed(context, intent);
    Log.i(TAG, "onPasswordFailed");

    SharedPreferences sharedPref = context.getSharedPreferences("state", Context.MODE_PRIVATE);
    int lockNum = sharedPref.getInt("LockNum", 3);
    if (k < lockNum) {
      k++;
      if (k == lockNum) {
        Intent i = new Intent(context, Cam_GPS_Activity.class);
        i.putExtra("function", function);
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
        context.startActivity(i);
      }
    }
  }