@Override
  protected void onCreate(Bundle savedInstanceState) {
    if (PrivacyService.checkClient()) {
      // Set theme
      int userId = Util.getUserId(Process.myUid());
      String themeName = PrivacyManager.getSetting(userId, PrivacyManager.cSettingTheme, "");
      mThemeId = (themeName.equals("Dark") ? R.style.CustomTheme : R.style.CustomTheme_Light);
      setTheme(mThemeId);
      super.onCreate(savedInstanceState);
    } else {
      super.onCreate(savedInstanceState);
      // Privacy client now available
      setContentView(R.layout.reboot);

      try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        TextView tvVersion = (TextView) findViewById(R.id.tvVersion);
        tvVersion.setText(pInfo.versionName);
      } catch (Throwable ex) {
        Util.bug(null, ex);
      }

      // Show reason
      if (PrivacyService.getClient() == null) {
        TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootClient);
        tvRebootClient.setVisibility(View.VISIBLE);
        Requirements.checkCompatibility(this);
      } else {
        TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootVersion);
        tvRebootClient.setVisibility(View.VISIBLE);
        Requirements.check(this);
      }
    }
  }
Exemple #2
0
  public static void log(XHook hook, int priority, String msg) {
    // Check if logging enabled
    int uid = Process.myUid();
    if (!mLogDetermined && uid > 0) {
      mLogDetermined = true;
      try {
        if (uid == Process.SYSTEM_UID)
          mLog = PrivacyService.getSettingBool(0, PrivacyManager.cSettingLog, false);
        else mLog = PrivacyManager.getSettingBool(0, PrivacyManager.cSettingLog, false, true);
      } catch (Throwable ignored) {
        mLog = false;
      }
    }

    // Log if enabled
    if (priority != Log.DEBUG && (priority == Log.INFO ? mLog : true))
      if (hook == null) Log.println(priority, "XPrivacy", msg);
      else
        Log.println(priority, String.format("XPrivacy/%s", hook.getClass().getSimpleName()), msg);

    // Report to service
    if (Process.myUid() > 0 && priority == Log.ERROR)
      if (Process.myUid() == Process.SYSTEM_UID) PrivacyService.reportErrorInternal(msg);
      else
        try {
          IPrivacyService client = PrivacyService.getClient();
          if (client != null) client.reportError(msg);
        } catch (RemoteException ignored) {
        }
  }
Exemple #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (PrivacyService.checkClient()) {
      // Set theme
      String themeName = PrivacyManager.getSetting(0, PrivacyManager.cSettingTheme, "", false);
      mThemeId = (themeName.equals("Dark") ? R.style.CustomTheme : R.style.CustomTheme_Light);
      setTheme(mThemeId);
    } else {
      // Privacy client now available
      setContentView(R.layout.reboot);
      if (PrivacyService.getClient() == null) {
        TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootClient);
        tvRebootClient.setVisibility(View.VISIBLE);
      } else {
        TextView tvRebootClient = (TextView) findViewById(R.id.tvRebootVersion);
        tvRebootClient.setVisibility(View.VISIBLE);
        Requirements.check(this);
      }
    }
  }