BaseHook.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.example.modifiermodule;
  2. import android.annotation.SuppressLint;
  3. import android.text.TextUtils;
  4. import android.util.Log;
  5. import java.lang.reflect.Method;
  6. import de.robv.android.xposed.XposedBridge;
  7. public class BaseHook {
  8. static final String PROP_MCC = "persist.spoof.mcc";
  9. static final String PROP_MNC = "persist.spoof.mnc";
  10. static final String PROP_ICCID = "persist.spoof.iccid";
  11. static final String PROP_IMSI = "persist.spoof.imsi";
  12. static final String PROP_IMEI = "persist.spoof.imei";
  13. static final String PROP_NUMBER = "persist.spoof.number";
  14. static final String PROP_COUNTRY = "persist.spoof.country";
  15. static final String PROP_CARRIER_ID = "persist.spoof.carrier.id";
  16. static final String PROP_CARRIER_NAME = "persist.spoof.carrier.name";
  17. static final String TAG = "Modifier";
  18. static void log(String message) {
  19. Log.i(TAG, message);
  20. XposedBridge.log(TAG + ": " + message);
  21. }
  22. @SuppressLint("PrivateApi")
  23. static String getProperty(String key, String defaultValue) {
  24. String value = defaultValue;
  25. try {
  26. Class<?> c = Class.forName("android.os.SystemProperties");
  27. Method get = c.getMethod("get", String.class, String.class);
  28. value = (String) (get.invoke(c, key, defaultValue));
  29. if (TextUtils.isEmpty(value)) {
  30. value = defaultValue;
  31. }
  32. } catch (Exception e) {
  33. e.printStackTrace();
  34. }
  35. return value;
  36. }
  37. }