Skip to content

Instantly share code, notes, and snippets.

@CFM880
Last active October 15, 2024 09:15
Show Gist options
  • Save CFM880/56d74fc2de20092922ed8c0424f129fb to your computer and use it in GitHub Desktop.
Save CFM880/56d74fc2de20092922ed8c0424f129fb to your computer and use it in GitHub Desktop.
AOSP检测隐私政策patch
project frameworks/base/
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index db5dcc5c264b..404db6dfaf64 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -741,6 +741,7 @@ public class Activity extends ContextThemeWrapper
OnCreateContextMenuListener, ComponentCallbacks2,
Window.OnWindowDismissedCallback,
AutofillManager.AutofillClient, ContentCaptureManager.ContentCaptureClient {
+ private static final String TAG_CFM880 = "Activity_CFM880";
private static final String TAG = "Activity";
private static final boolean DEBUG_LIFECYCLE = false;
@@ -5284,6 +5285,11 @@ public class Activity extends ContextThemeWrapper
* @see #shouldShowRequestPermissionRationale(String)
*/
public final void requestPermissions(@NonNull String[] permissions, int requestCode) {
+ try {
+ throw new Throwable("requestPermissions("+Arrays.toString(permissions)+","+ requestCode +")>>>>申请具体权限看");
+ } catch (Throwable throwable) {
+ Log.d(TAG, Log.getStackTraceString(throwable));
+ }
if (requestCode < 0) {
throw new IllegalArgumentException("requestCode should be >= 0");
}
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 4376d225e676..21e64dccaecb 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -75,6 +75,7 @@ import android.os.WorkSource;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.DisplayMetrics;
+import android.util.Log;
import android.util.Singleton;
import android.util.Size;
import android.util.TypedXmlPullParser;
@@ -141,6 +142,7 @@ import java.util.concurrent.Executor;
@SystemService(Context.ACTIVITY_SERVICE)
public class ActivityManager {
private static String TAG = "ActivityManager";
+ private static final String TAG_CFM880 = "ActivityManager_CFM880";
@UnsupportedAppUsage
private final Context mContext;
@@ -2545,6 +2547,11 @@ public class ActivityManager {
*/
public PendingIntent getRunningServiceControlPanel(ComponentName service)
throws SecurityException {
+ try {
+ throw new Throwable("getRunningServiceControlPanel()>>>>获取了正在运行的服务面板");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return getService()
.getRunningServiceControlPanel(service);
@@ -3365,6 +3372,11 @@ public class ActivityManager {
* specified.
*/
public List<RunningAppProcessInfo> getRunningAppProcesses() {
+ try {
+ throw new Throwable("getRunningAppProcesses()>>>>获取了正在运行的App");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return getService().getRunningAppProcesses();
} catch (RemoteException e) {
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index cd2c12cb4b6f..bebb714c9297 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -145,6 +145,7 @@ import java.util.function.Consumer;
/** @hide */
public class ApplicationPackageManager extends PackageManager {
private static final String TAG = "ApplicationPackageManager";
+ private static final String TAG_CFM880 = "ApplicationPackageManager_CFM880";
private static final boolean DEBUG_ICONS = false;
private static final int DEFAULT_EPHEMERAL_COOKIE_MAX_SIZE_BYTES = 16384; // 16KB
@@ -1082,6 +1083,11 @@ public class ApplicationPackageManager extends PackageManager {
@SuppressWarnings("unchecked")
@Override
public List<PackageInfo> getInstalledPackages(int flags) {
+ try {
+ throw new Throwable("getInstalledPackages()>>>>获取已安装APP列表包信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return getInstalledPackagesAsUser(flags, getUserId());
}
@@ -1122,6 +1128,11 @@ public class ApplicationPackageManager extends PackageManager {
@SuppressWarnings("unchecked")
@Override
public List<ApplicationInfo> getInstalledApplications(int flags) {
+ try {
+ throw new Throwable("getInstalledApplications()>>>>获取已安装APP列表应用信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return getInstalledApplicationsAsUser(flags, getUserId());
}
@@ -1258,6 +1269,11 @@ public class ApplicationPackageManager extends PackageManager {
@Override
public List<ResolveInfo> queryIntentActivities(Intent intent,
int flags) {
+ try {
+ throw new Throwable("getInstalledApplications()>>>>查询其他APP启动Intent");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return queryIntentActivitiesAsUser(intent, flags, getUserId());
}
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 0e04ad3768c7..24b5037ed30f 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -153,7 +153,7 @@ import java.util.concurrent.Executor;
@RequiresFeature(PackageManager.FEATURE_DEVICE_ADMIN)
@SuppressLint("UseIcu")
public class DevicePolicyManager {
-
+ private static final String TAG_CFM880 ="DevicePolicyManager_CFM880";
private static String TAG = "DevicePolicyManager";
private final Context mContext;
@@ -11155,6 +11155,11 @@ public class DevicePolicyManager {
* @throws SecurityException if {@code admin} is not a device owner.
*/
public @Nullable String getWifiMacAddress(@NonNull ComponentName admin) {
+ try {
+ throw new Throwable("getWifiMacAddress(admin)>>>>获取mac地址");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
throwIfParentInstance("getWifiMacAddress");
try {
return mService.getWifiMacAddress(admin);
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 5094498dbee5..e4fe1d704c20 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -122,6 +122,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* {@see BluetoothServerSocket}
*/
public final class BluetoothAdapter {
+ private static final String TAG_CFM880 = "BluetoothAdapter_CFM880";
private static final String TAG = "BluetoothAdapter";
private static final String DESCRIPTOR = "android.bluetooth.BluetoothAdapter";
private static final boolean DBG = true;
@@ -1293,6 +1294,11 @@ public final class BluetoothAdapter {
@RequiresBluetoothConnectPermission
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public String getName() {
+ try {
+ throw new Throwable("gccc");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mManagerService.getName(mAttributionSource);
} catch (RemoteException e) {
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index bbb550fd6343..18c498f7afa2 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -85,6 +85,7 @@ import java.util.UUID;
* {@see BluetoothSocket}
*/
public final class BluetoothDevice implements Parcelable, Attributable {
+ private static final String TAG_CFM880 = "BluetoothDevice_CFM880";
private static final String TAG = "BluetoothDevice";
private static final boolean DBG = false;
@@ -1235,6 +1236,11 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* @return Bluetooth hardware address as string
*/
public String getAddress() {
+ try {
+ throw new Throwable("getAddress()>>>>获取蓝牙设备mac");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
if (DBG) Log.d(TAG, "mAddress: " + mAddress);
return mAddress;
}
@@ -1264,6 +1270,11 @@ public final class BluetoothDevice implements Parcelable, Attributable {
@RequiresBluetoothConnectPermission
@RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
public String getName() {
+ try {
+ throw new Throwable("getName()>>>>获取蓝牙设备名称");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
final IBluetooth service = sService;
if (service == null) {
Log.e(TAG, "BT not enabled. Cannot get Remote Device name");
diff --git a/core/java/android/content/ClipboardManager.java b/core/java/android/content/ClipboardManager.java
index d41cda102103..375a142626c6 100644
--- a/core/java/android/content/ClipboardManager.java
+++ b/core/java/android/content/ClipboardManager.java
@@ -28,6 +28,7 @@ import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
+import android.util.Log;
import java.util.ArrayList;
import java.util.Objects;
@@ -51,6 +52,7 @@ import java.util.Objects;
*/
@SystemService(Context.CLIPBOARD_SERVICE)
public class ClipboardManager extends android.text.ClipboardManager {
+ private static final String TAG_CFM880 = "ClipboardManager_CFM880";
/**
* DeviceConfig property, within the clipboard namespace, that determines whether notifications
@@ -182,6 +184,11 @@ public class ClipboardManager extends android.text.ClipboardManager {
* @see #setPrimaryClip(ClipData)
*/
public @Nullable ClipData getPrimaryClip() {
+ try {
+ throw new Throwable("getPrimaryClip()>>>>读取剪切板信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getPrimaryClip(mContext.getOpPackageName(), mContext.getUserId());
} catch (RemoteException e) {
@@ -214,6 +221,11 @@ public class ClipboardManager extends android.text.ClipboardManager {
* return {@code false}.</em>
*/
public boolean hasPrimaryClip() {
+ try {
+ throw new Throwable("hasPrimaryClip()>>>>检测是否有剪切内容");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.hasPrimaryClip(mContext.getOpPackageName(), mContext.getUserId());
} catch (RemoteException e) {
diff --git a/core/java/android/content/ContentResolver.java b/core/java/android/content/ContentResolver.java
index 265ff331ffa0..8116afbaed64 100644
--- a/core/java/android/content/ContentResolver.java
+++ b/core/java/android/content/ContentResolver.java
@@ -63,6 +63,10 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.provider.BrowserContract;
+import android.provider.CalendarContract;
+import android.provider.ContactsContract;
+import android.provider.MediaStore;
import android.system.Int64Ref;
import android.text.TextUtils;
import android.util.EventLog;
@@ -101,6 +105,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* </div>
*/
public abstract class ContentResolver implements ContentInterface {
+ private static final String TAG_CFM880 = "ContentResolver_CFM880";
/**
* Enables logic that supports deprecation of {@code _data} columns,
* typically by replacing values with fake paths that the OS then offers to
@@ -1191,6 +1196,25 @@ public abstract class ContentResolver implements ContentInterface {
@Nullable String[] projection, @Nullable Bundle queryArgs,
@Nullable CancellationSignal cancellationSignal) {
Objects.requireNonNull(uri, "uri");
+ String tips = "";
+ String url = uri.toString();
+ if (url.contains(ContactsContract.AUTHORITY)) {
+ tips = "获取手机通信录内容";
+ } else if (url.contains(CalendarContract.AUTHORITY)) {
+ tips = "获取日历内容";
+ } else if (url.contains(BrowserContract.AUTHORITY)) {
+ tips = "获取浏览器内容";
+ } else if (url.contains(MediaStore.AUTHORITY)) {
+ tips = "获取相册内容";
+ }
+ if (!tips.isEmpty()) {
+ try {
+
+ throw new Throwable("query()>>>>"+tips);
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
+ }
try {
if (mWrapped != null) {
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 3bdd39f5d7d7..388515956539 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -156,6 +156,7 @@ import java.util.List;
*/
@Deprecated
public class Camera {
+ private static final String TAG_CFM880 = "Camera_CFM880";
private static final String TAG = "Camera";
// These match the enums in frameworks/base/include/camera/Camera.h
@@ -395,6 +396,11 @@ public class Camera {
* @see android.app.admin.DevicePolicyManager#getCameraDisabled(android.content.ComponentName)
*/
public static Camera open(int cameraId) {
+ try {
+ throw new Throwable("open("+cameraId+")>>>>调用摄像头");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return new Camera(cameraId);
}
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index 572a8a81883a..528dce6b7a6a 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -88,6 +88,7 @@ import java.util.List;
*/
@SystemService(Context.SENSOR_SERVICE)
public abstract class SensorManager {
+ private static final String TAG_CFM880 = "SensorManager_CFM880";
/** @hide */
protected static final String TAG = "SensorManager";
@@ -425,6 +426,11 @@ public abstract class SensorManager {
* @see Sensor
*/
public List<Sensor> getSensorList(int type) {
+ try {
+ throw new Throwable("getSensorList("+type+")>>>>获取传感器信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
// cache the returned lists the first time
List<Sensor> list;
final List<Sensor> fullList = getFullSensorList();
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 5833b3dbef86..a6f0c7193715 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -74,6 +74,7 @@ import java.util.concurrent.TimeUnit;
public final class CameraManager {
private static final String TAG = "CameraManager";
+ private static final String TAG_CFM880 = "CameraManager_CFM880";
private final boolean DEBUG = false;
private static final int USE_CALLING_UID = -1;
@@ -567,6 +568,11 @@ public final class CameraManager {
private CameraDevice openCameraDeviceUserAsync(String cameraId,
CameraDevice.StateCallback callback, Executor executor, final int uid,
final int oomScoreOffset) throws CameraAccessException {
+ try {
+ throw new Throwable("openCameraDeviceUserAsync()>>>>调用摄像头");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
CameraCharacteristics characteristics = getCameraCharacteristics(cameraId);
CameraDevice device = null;
Map<String, CameraCharacteristics> physicalIdsToChars =
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java
index 6bf394dc347b..2033fe96efe7 100755
--- a/core/java/android/os/Build.java
+++ b/core/java/android/os/Build.java
@@ -31,6 +31,7 @@ import android.sysprop.DeviceProperties;
import android.sysprop.SocProperties;
import android.sysprop.TelephonyProperties;
import android.text.TextUtils;
+import android.util.Log;
import android.util.Slog;
import android.view.View;
@@ -38,6 +39,7 @@ import dalvik.system.VMRuntime;
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -46,6 +48,7 @@ import java.util.stream.Collectors;
*/
public class Build {
private static final String TAG = "Build";
+ private static final String TAG_CFM880 = "Build_CFM880";
/** Value used for when a build property is unknown. */
public static final String UNKNOWN = "unknown";
@@ -199,6 +202,11 @@ public class Build {
@SuppressAutoDoc // No support for device / profile owner.
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public static String getSerial() {
+ try {
+ throw new Throwable("getSerial()>>>>获取设备序列号");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
IDeviceIdentifiersPolicyService service = IDeviceIdentifiersPolicyService.Stub
.asInterface(ServiceManager.getService(Context.DEVICE_IDENTIFIERS_SERVICE));
try {
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index ab741990430f..2e32918e3363 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -53,6 +53,7 @@ import java.util.HashMap;
@SystemApi
public class SystemProperties {
private static final String TAG = "SystemProperties";
+ private static final String TAG_CFM880 = "SystemProperties_CFM880";
private static final boolean TRACK_KEY_ACCESS = false;
/**
@@ -161,6 +162,11 @@ public class SystemProperties {
@NonNull
@SystemApi
public static String get(@NonNull String key, @Nullable String def) {
+// try {
+// throw new Throwable("get (" + key +")");
+// } catch (Throwable throwable) {
+// Log.d(TAG, Log.getStackTraceString(throwable));
+// }
if (TRACK_KEY_ACCESS) onKeyAccess(key);
return native_get(key, def);
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ac520e8b3dec..1a96770c1ae5 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2608,6 +2608,7 @@ public final class Settings {
public static final String AUTHORITY = "settings";
private static final String TAG = "Settings";
+ private static final String TAG_CFM880 = "Settings_CFM880";
private static final boolean LOCAL_LOGV = false;
// Used in system server calling uid workaround in call()
@@ -3450,6 +3451,13 @@ public final class Settings {
* @return the corresponding value, or null if not present
*/
public static String getString(ContentResolver resolver, String name) {
+ if (ANDROID_ID.equals(name)) {
+ try {
+ throw new Throwable(name);
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, "System#getString(ANDROID_ID)>>>>获取安卓ID" + Log.getStackTraceString(throwable));
+ }
+ }
return getStringForUser(resolver, name, resolver.getUserId());
}
@@ -5789,6 +5797,13 @@ public final class Settings {
@UnsupportedAppUsage
public static String getStringForUser(ContentResolver resolver, String name,
int userHandle) {
+ if (ANDROID_ID.equals(name)) {
+ try {
+ throw new Throwable(name);
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, "Secure#getString(ANDROID_ID)>>>>获取安卓ID" + Log.getStackTraceString(throwable));
+ }
+ }
if (MOVED_TO_GLOBAL.contains(name)) {
Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
+ " to android.provider.Settings.Global.");
diff --git a/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk b/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
index 2d8556f2a3c7..16bdd1413a49 100644
--- a/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
+++ b/core/tests/hosttests/test-apps/MultiDexLegacyAndException/Android.mk
@@ -43,9 +43,9 @@ LOCAL_MIN_SDK_VERSION := 8
include $(BUILD_PACKAGE)
-$(mainDexList): $(full_classes_pre_proguard_jar) $(MAINDEXCLASSES) $(PROGUARD_DEPS)
- $(hide) mkdir -p $(dir $@)
- PROGUARD_HOME=$(PROGUARD_HOME) $(MAINDEXCLASSES) $< 1>$@
- echo "com/android/multidexlegacyandexception/Test.class" >> $@
+# $(mainDexList): $(full_classes_pre_proguard_jar) $(MAINDEXCLASSES) $(PROGUARD_DEPS)
+# $(hide) mkdir -p $(dir $@)
+# PROGUARD_HOME=$(PROGUARD_HOME) $(MAINDEXCLASSES) $< 1>$@
+# echo "com/android/multidexlegacyandexception/Test.class" >> $@
$(built_dex_intermediate): $(mainDexList)
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java
index 209903c57d90..68c4ad12263e 100644
--- a/location/java/android/location/Location.java
+++ b/location/java/android/location/Location.java
@@ -27,6 +27,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
+import android.util.Log;
import android.util.Printer;
import android.util.TimeUtils;
@@ -46,6 +47,7 @@ import java.util.StringTokenizer;
* parameters are optional.
*/
public class Location implements Parcelable {
+ private static final String TAG_CFM880 = "Location_CFM880";
/**
* Constant used to specify formatting of a latitude or longitude
@@ -495,6 +497,11 @@ public class Location implements Parcelable {
* @return the provider, or null if it has not been set
*/
public String getProvider() {
+ try {
+ throw new Throwable("getProvider()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mProvider;
}
@@ -529,6 +536,11 @@ public class Location implements Parcelable {
* @return UTC time of fix, in milliseconds since January 1, 1970.
*/
public long getTime() {
+ try {
+ throw new Throwable("getTime()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mTime;
}
@@ -556,6 +568,11 @@ public class Location implements Parcelable {
* @return elapsed realtime of fix, in nanoseconds since system boot.
*/
public long getElapsedRealtimeNanos() {
+ try {
+ throw new Throwable("getElapsedRealtimeNanos()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mElapsedRealtimeNanos;
}
@@ -647,6 +664,11 @@ public class Location implements Parcelable {
* will have a valid latitude.
*/
public double getLatitude() {
+ try {
+ throw new Throwable("getLatitude()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mLatitude;
}
@@ -664,6 +686,11 @@ public class Location implements Parcelable {
* will have a valid longitude.
*/
public double getLongitude() {
+ try {
+ throw new Throwable("getLongitude()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mLongitude;
}
@@ -688,6 +715,11 @@ public class Location implements Parcelable {
* <p>If this location does not have an altitude then 0.0 is returned.
*/
public double getAltitude() {
+ try {
+ throw new Throwable("getAltitude()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mAltitude;
}
@@ -728,6 +760,11 @@ public class Location implements Parcelable {
* <p>If this location does not have a speed then 0.0 is returned.
*/
public float getSpeed() {
+ try {
+ throw new Throwable("getSpeed()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mSpeed;
}
@@ -772,6 +809,11 @@ public class Location implements Parcelable {
* <p>If this location does not have a bearing then 0.0 is returned.
*/
public float getBearing() {
+ try {
+ throw new Throwable("getBearing()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mBearing;
}
@@ -834,6 +876,11 @@ public class Location implements Parcelable {
* All locations generated by the {@link LocationManager} include horizontal accuracy.
*/
public float getAccuracy() {
+ try {
+ throw new Throwable("getAccuracy()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mHorizontalAccuracyMeters;
}
@@ -884,6 +931,11 @@ public class Location implements Parcelable {
* there is a 68% probability of the true altitude being between 130m and 170m.
*/
public float getVerticalAccuracyMeters() {
+ try {
+ throw new Throwable("getVerticalAccuracyMeters()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mVerticalAccuracyMeters;
}
@@ -939,6 +991,11 @@ public class Location implements Parcelable {
* satellites are taken into account.
*/
public float getSpeedAccuracyMetersPerSecond() {
+ try {
+ throw new Throwable("getSpeedAccuracyMetersPerSecond()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mSpeedAccuracyMetersPerSecond;
}
@@ -990,6 +1047,11 @@ public class Location implements Parcelable {
* is a 68% probability of the true bearing being between 50° and 70°.
*/
public float getBearingAccuracyDegrees() {
+ try {
+ throw new Throwable("getBearingAccuracyDegrees()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mBearingAccuracyDegrees;
}
@@ -1071,6 +1133,11 @@ public class Location implements Parcelable {
* </ul>
*/
public Bundle getExtras() {
+ try {
+ throw new Throwable("getExtras()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mExtras;
}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 526b84e85e38..96277351674d 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -63,6 +63,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.util.Log;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.listeners.ListenerExecutor;
@@ -95,6 +96,7 @@ import java.util.function.Consumer;
@SystemService(Context.LOCATION_SERVICE)
@RequiresFeature(PackageManager.FEATURE_LOCATION)
public class LocationManager {
+ private static final String TAG_CFM880 = "LocationManager_CFM880";
/**
* For apps targeting Android S and above, immutable PendingIntents passed into location APIs
@@ -822,7 +824,11 @@ public class LocationManager {
Preconditions.checkArgument(provider != null, "invalid null provider");
Preconditions.checkArgument(lastLocationRequest != null,
"invalid null last location request");
-
+ try {
+ throw new Throwable("getLastKnownLocation()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getLastLocation(provider, lastLocationRequest,
mContext.getPackageName(), mContext.getAttributionTag());
@@ -852,6 +858,11 @@ public class LocationManager {
public void getCurrentLocation(@NonNull String provider,
@Nullable CancellationSignal cancellationSignal,
@NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Location> consumer) {
+ try {
+ throw new Throwable("getCurrentLocation >>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
getCurrentLocation(
provider,
new LocationRequest.Builder(0).build(),
@@ -978,6 +989,11 @@ public class LocationManager {
public void requestSingleUpdate(
@NonNull String provider, @NonNull LocationListener listener, @Nullable Looper looper) {
Preconditions.checkArgument(provider != null, "invalid null provider");
+ try {
+ throw new Throwable("requestSingleUpdate()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
Handler handler = looper == null ? new Handler() : new Handler(looper);
requestLocationUpdates(
@@ -1529,6 +1545,11 @@ public class LocationManager {
public void requestLocationUpdates(@NonNull String provider,
@NonNull LocationRequest locationRequest,
@NonNull PendingIntent pendingIntent) {
+ try {
+ throw new Throwable("requestLocationUpdates()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
Preconditions.checkArgument(provider != null, "invalid null provider");
Preconditions.checkArgument(locationRequest != null, "invalid null location request");
Preconditions.checkArgument(pendingIntent != null, "invalid null pending intent");
@@ -1788,6 +1809,11 @@ public class LocationManager {
*/
public @Nullable String getBestProvider(@NonNull Criteria criteria, boolean enabledOnly) {
Preconditions.checkArgument(criteria != null, "invalid null criteria");
+ try {
+ throw new Throwable("getBestProvider()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getBestProvider(criteria, enabledOnly);
@@ -1812,7 +1838,11 @@ public class LocationManager {
@Deprecated
public @Nullable LocationProvider getProvider(@NonNull String provider) {
Preconditions.checkArgument(provider != null, "invalid null provider");
-
+ try {
+ throw new Throwable("getProvider()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
if (!Compatibility.isChangeEnabled(GET_PROVIDER_SECURITY_EXCEPTIONS)) {
if (NETWORK_PROVIDER.equals(provider) || FUSED_PROVIDER.equals(provider)) {
try {
@@ -2252,6 +2282,11 @@ public class LocationManager {
* is before 2016.
*/
public int getGnssYearOfHardware() {
+ try {
+ throw new Throwable("getGnssYearOfHardware()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getGnssYearOfHardware();
} catch (RemoteException e) {
@@ -2267,6 +2302,11 @@ public class LocationManager {
*/
@Nullable
public String getGnssHardwareModelName() {
+ try {
+ throw new Throwable("getGnssHardwareModelName()>>>>获取位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getGnssHardwareModelName();
} catch (RemoteException e) {
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 5171cf9dcea7..9e03d79a7018 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -76,6 +76,7 @@ import java.util.concurrent.Executor;
* @see SubscriptionManager#getActiveSubscriptionInfoList()
*/
public final class SmsManager {
+ private static final String TAG_CFM880 = "SmsManager_CFM880";
private static final String TAG = "SmsManager";
private static final Object sLockObject = new Object();
@@ -601,6 +602,11 @@ public final class SmsManager {
private void sendTextMessageInternal(String destinationAddress, String scAddress,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessage, String packageName, String attributionTag, long messageId) {
+ try {
+ throw new Throwable("sendTextMessageInternal()>>>>'获取短信信息-发送短信");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
if (TextUtils.isEmpty(destinationAddress)) {
throw new IllegalArgumentException("Invalid destinationAddress");
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 114c90bbd87a..41f4519ac009 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -94,6 +94,7 @@ import java.util.stream.Collectors;
@SystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)
public class SubscriptionManager {
private static final String LOG_TAG = "SubscriptionManager";
+ private static final String TAG_CFM880 = "SubscriptionManager_CFM880";
private static final boolean DBG = false;
private static final boolean VDBG = false;
@@ -1541,6 +1542,11 @@ public class SubscriptionManager {
@SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
public List<SubscriptionInfo> getActiveSubscriptionInfoList() {
+ try {
+ throw new Throwable("get Phone number getActiveSubscriptionInfoList");
+ } catch (Throwable e) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(e));
+ }
return getActiveSubscriptionInfoList(/* userVisibleonly */true);
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 255a61266ebf..7aa211aeecbd 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -170,6 +170,7 @@ import java.util.stream.IntStream;
@SystemService(Context.TELEPHONY_SERVICE)
public class TelephonyManager {
private static final String TAG = "TelephonyManager";
+ private static final String TAG_CFM880 = "TelephonyManager_CFM880";
private TelephonyRegistryManager mTelephonyRegistryMgr;
/**
@@ -1963,6 +1964,11 @@ public class TelephonyManager {
@SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236).
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getDeviceId() {
+ try {
+ throw new Throwable("getDeviceId():获取IMEI");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony telephony = getITelephony();
if (telephony == null)
@@ -2040,6 +2046,7 @@ public class TelephonyManager {
@SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236).
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getImei() {
+
return getImei(getSlotIndex());
}
@@ -2081,6 +2088,11 @@ public class TelephonyManager {
@SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236).
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getImei(int slotIndex) {
+ try {
+ throw new Throwable("getImei("+slotIndex+")>>>>获取IMEI");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
ITelephony telephony = getITelephony();
if (telephony == null) return null;
@@ -2193,6 +2205,12 @@ public class TelephonyManager {
@SuppressAutoDoc // No support for device / profile owner or carrier privileges (b/72967236).
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getMeid(int slotIndex) {
+ try {
+ throw new Throwable("getMeid("+slotIndex+")>>>>获取MEID");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+
+ }
ITelephony telephony = getITelephony();
if (telephony == null) return null;
@@ -2348,6 +2366,11 @@ public class TelephonyManager {
@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public CellLocation getCellLocation() {
+ try {
+ throw new Throwable("getCellLocation()>>>>获取电话当前位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony telephony = getITelephony();
if (telephony == null) {
@@ -2620,6 +2643,11 @@ public class TelephonyManager {
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public String getNetworkOperatorName(int subId) {
+ try {
+ throw new Throwable("getNetworkOperatorName("+subId+")>>>>获取MCC/MNC");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
int phoneId = SubscriptionManager.getPhoneId(subId);
return getTelephonyProperty(phoneId, TelephonyProperties.operator_alpha(), "");
}
@@ -3612,6 +3640,7 @@ public class TelephonyManager {
* @see #getSimState
*/
public String getSimOperator() {
+
return getSimOperatorNumeric();
}
@@ -3755,6 +3784,11 @@ public class TelephonyManager {
*/
@UnsupportedAppUsage
public static String getSimCountryIsoForPhone(int phoneId) {
+ try {
+ throw new Throwable("getSimCountryIsoForPhone("+phoneId+")>>>>获取SIM卡国家代码");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return getTelephonyProperty(phoneId, TelephonyProperties.icc_operator_iso_country(), "");
}
@@ -3830,6 +3864,11 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@UnsupportedAppUsage
public String getSimSerialNumber(int subId) {
+ try {
+ throw new Throwable("getSimSerialNumber("+subId+")>>>>获取IMSI/iccid");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
IPhoneSubInfo info = getSubscriberInfoService();
if (info == null)
@@ -4098,6 +4137,11 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public String getSubscriberId(int subId) {
+ try {
+ throw new Throwable("getSubscriberId("+subId+")>>>>获取IMSI");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
IPhoneSubInfo info = getSubscriberInfoService();
if (info == null)
@@ -4704,6 +4748,11 @@ public class TelephonyManager {
})
@UnsupportedAppUsage
public String getLine1Number(int subId) {
+ try {
+ throw new Throwable("getLine1Number("+subId+")>>>>获取电话号码标识符");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
String number = null;
try {
ITelephony telephony = getITelephony();
@@ -6224,6 +6273,11 @@ public class TelephonyManager {
*/
@RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public List<CellInfo> getAllCellInfo() {
+ try {
+ throw new Throwable("getSimSerialNumber()>>>>获取电话当前位置信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony telephony = getITelephony();
if (telephony == null)
@@ -6319,6 +6373,11 @@ public class TelephonyManager {
@RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION)
public void requestCellInfoUpdate(
@NonNull @CallbackExecutor Executor executor, @NonNull CellInfoCallback callback) {
+ try {
+ throw new Throwable("requestCellInfoUpdate(executor, callback)>>>>获取基站信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony telephony = getITelephony();
if (telephony == null) {
@@ -6382,6 +6441,11 @@ public class TelephonyManager {
android.Manifest.permission.MODIFY_PHONE_STATE})
public void requestCellInfoUpdate(@NonNull WorkSource workSource,
@NonNull @CallbackExecutor Executor executor, @NonNull CellInfoCallback callback) {
+ try {
+ throw new Throwable("requestCellInfoUpdate(workSource, executor, callback)>>>>获取基站信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony telephony = getITelephony();
if (telephony == null) {
@@ -7242,6 +7306,11 @@ public class TelephonyManager {
*
*/
public int getSubscriptionId() {
+ try {
+ throw new Throwable("getSubscriptionId()>>>>获取IMSI");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return getSubId();
}
@@ -11451,6 +11520,11 @@ public class TelephonyManager {
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public ServiceState getServiceStateForSubscriber(int subId) {
+ try {
+ throw new Throwable("getServiceStateForSubscriber("+subId+")>>>>获取sim卡是否可用");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ITelephony service = getITelephony();
if (service != null) {
diff --git a/telephony/java/android/telephony/cdma/CdmaCellLocation.java b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
index d808cabaaa92..9a81ad157cd9 100644
--- a/telephony/java/android/telephony/cdma/CdmaCellLocation.java
+++ b/telephony/java/android/telephony/cdma/CdmaCellLocation.java
@@ -20,6 +20,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Bundle;
import android.telephony.CellLocation;
+import android.util.Log;
/**
* Represents the cell location on a CDMA phone.
@@ -28,6 +29,7 @@ import android.telephony.CellLocation;
*/
@Deprecated
public class CdmaCellLocation extends CellLocation {
+ private static final String TAG_CFM880 = "CdmaCellLocation_CFM880";
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
private int mBaseStationId = -1;
@@ -87,6 +89,11 @@ public class CdmaCellLocation extends CellLocation {
* @return cdma base station identification number, -1 if unknown
*/
public int getBaseStationId() {
+ try {
+ throw new Throwable("getBaseStationId()>>>>获取基站cid信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return this.mBaseStationId;
}
@@ -127,6 +134,11 @@ public class CdmaCellLocation extends CellLocation {
* @return cdma network identification number, -1 if unknown
*/
public int getNetworkId() {
+ try {
+ throw new Throwable("getNetworkId()>>>>获取基站lac信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return this.mNetworkId;
}
diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java
index 2eee4ce371a0..0aec112047b5 100644
--- a/telephony/java/android/telephony/gsm/GsmCellLocation.java
+++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java
@@ -20,6 +20,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Bundle;
import android.telephony.CellLocation;
+import android.util.Log;
/**
* Represents the cell location on a GSM phone.
@@ -28,6 +29,7 @@ import android.telephony.CellLocation;
*/
@Deprecated
public class GsmCellLocation extends CellLocation {
+ private static final String TAG_CFM880 = "GsmCellLocation_CFM880";
private int mLac;
private int mCid;
private int mPsc;
@@ -54,6 +56,11 @@ public class GsmCellLocation extends CellLocation {
* @return gsm location area code, -1 if unknown, 0xffff max legal value
*/
public int getLac() {
+ try {
+ throw new Throwable("getLac()>>>>获取基站lac信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mLac;
}
@@ -61,6 +68,11 @@ public class GsmCellLocation extends CellLocation {
* @return gsm cell id, -1 if unknown or invalid, 0xffff max legal value
*/
public int getCid() {
+ try {
+ throw new Throwable("getCid()>>>>获取基站cid信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mCid;
}
project libcore/
diff --git a/ojluni/src/main/java/java/io/File.java b/ojluni/src/main/java/java/io/File.java
index 00375341184..cb4366c3a8c 100644
--- a/ojluni/src/main/java/java/io/File.java
+++ b/ojluni/src/main/java/java/io/File.java
@@ -155,6 +155,7 @@ import sun.security.action.GetPropertyAction;
public class File
implements Serializable, Comparable<File>
{
+ private static final String TAG = "File_CFM880";
/**
* The FileSystem object representing the platform's local file system.
@@ -1344,6 +1345,11 @@ public class File
* parent directories to be created
*/
public boolean mkdirs() {
+ try {
+ throw new Throwable(TAG+ " mkdirs()>>>>尝试写入sdcard创建小米市场审核可能不通过");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
if (exists()) {
return false;
}
diff --git a/ojluni/src/main/java/java/io/RandomAccessFile.java b/ojluni/src/main/java/java/io/RandomAccessFile.java
index 06683adeabd..5d1236596ae 100755
--- a/ojluni/src/main/java/java/io/RandomAccessFile.java
+++ b/ojluni/src/main/java/java/io/RandomAccessFile.java
@@ -67,7 +67,7 @@ import static android.system.OsConstants.*;
*/
public class RandomAccessFile implements DataOutput, DataInput, Closeable {
-
+ private static final String TAG = "RandomAccessFile_CFM880";
// BEGIN Android-added: CloseGuard and some helper fields for Android changes in this file.
@ReachabilitySensitive
private final CloseGuard guard = CloseGuard.get();
@@ -231,6 +231,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
public RandomAccessFile(File file, String mode)
throws FileNotFoundException
{
+ try {
+ throw new Throwable(TAG + " RandomAccessFile() RandomAccessFile写文件");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
String name = (file != null ? file.getPath() : null);
int imode = -1;
if (mode.equals("r")) {
diff --git a/ojluni/src/main/java/java/net/Inet4Address.java b/ojluni/src/main/java/java/net/Inet4Address.java
index 08952eef8f1..6d7b52fe16e 100644
--- a/ojluni/src/main/java/java/net/Inet4Address.java
+++ b/ojluni/src/main/java/java/net/Inet4Address.java
@@ -86,6 +86,7 @@ import static android.system.OsConstants.*;
public final
class Inet4Address extends InetAddress {
+ private static final String TAG_CFM880 = "Inet4Address_CFM880";
final static int INADDRSZ = 4;
/** use serialVersionUID from InetAddress, but Inet4Address instance
@@ -356,6 +357,11 @@ class Inet4Address extends InetAddress {
* @since JDK1.0.2
*/
public String getHostAddress() {
+ try {
+ throw new Throwable(TAG_CFM880 + " getHostAddress()>>>>获取IP地址");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
return numericToTextFormat(getAddress());
}
diff --git a/ojluni/src/main/java/java/net/NetworkInterface.java b/ojluni/src/main/java/java/net/NetworkInterface.java
index e56e0cb62a7..f347e8aedb7 100644
--- a/ojluni/src/main/java/java/net/NetworkInterface.java
+++ b/ojluni/src/main/java/java/net/NetworkInterface.java
@@ -38,6 +38,7 @@ import java.util.Map;
import java.util.NoSuchElementException;
import android.system.StructIfaddrs;
+
import libcore.io.IoUtils;
import libcore.io.Libcore;
import sun.security.action.*;
@@ -65,6 +66,7 @@ import static android.system.OsConstants.*;
* @since 1.4
*/
public final class NetworkInterface {
+ private static final String TAG_CFM880 = "NetworkInterface_CFM880";
private String name;
private String displayName;
private int index;
@@ -590,6 +592,11 @@ public final class NetworkInterface {
}
return getMacAddr0(null, name, index);
*/
+ try {
+ throw new Throwable(TAG_CFM880 + " getHardwareAddress()>>>>获取Mac地址");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();;
+ }
NetworkInterface ni = getByName(name);
if (ni == null) {
throw new SocketException("NetworkInterface doesn't exist anymore");
project packages/modules/Connectivity/
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 2eb5fb72a..7753b3d9a 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -113,6 +113,7 @@ import java.util.concurrent.RejectedExecutionException;
@SystemService(Context.CONNECTIVITY_SERVICE)
public class ConnectivityManager {
private static final String TAG = "ConnectivityManager";
+ private static final String TAG_CFM880 = "ConnectivityManager_CFM880";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
/**
diff --git a/framework/src/android/net/NetworkInfo.java b/framework/src/android/net/NetworkInfo.java
index bb2349459..a9444a305 100644
--- a/framework/src/android/net/NetworkInfo.java
+++ b/framework/src/android/net/NetworkInfo.java
@@ -22,6 +22,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
+import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -46,6 +47,7 @@ import java.util.EnumMap;
*/
@Deprecated
public class NetworkInfo implements Parcelable {
+ private static final String TAG_CFM880 = "NetworkInfo_CFM880";
/**
* Coarse-grained network state. This is probably what most applications should
@@ -215,6 +217,11 @@ public class NetworkInfo implements Parcelable {
*/
@Deprecated
public int getType() {
+ try {
+ throw new Throwable(TAG_CFM880 + "getType()>>>>获取网络类型");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
synchronized (this) {
return mNetworkType;
}
@@ -270,6 +277,11 @@ public class NetworkInfo implements Parcelable {
*/
@Deprecated
public String getTypeName() {
+ try {
+ throw new Throwable(TAG_CFM880 + " getTypeName()>>>>获取网络类型名称");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
synchronized (this) {
return mTypeName;
}
@@ -325,6 +337,11 @@ public class NetworkInfo implements Parcelable {
*/
@Deprecated
public boolean isConnected() {
+ try {
+ throw new Throwable(TAG_CFM880 +" isConnected()>>>>获取网络是否连接");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
synchronized (this) {
return mState == State.CONNECTED;
}
@@ -353,6 +370,11 @@ public class NetworkInfo implements Parcelable {
*/
@Deprecated
public boolean isAvailable() {
+ try {
+ throw new Throwable(TAG_CFM880 + " isAvailable()>>>>获取网络是否可用");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
synchronized (this) {
return mIsAvailable;
}
@@ -530,6 +552,11 @@ public class NetworkInfo implements Parcelable {
*/
@Deprecated
public String getExtraInfo() {
+ try {
+ throw new Throwable(TAG_CFM880 + " getExtraInfo()>>>>获取网络名称");
+ } catch (Throwable throwable) {
+ throwable.printStackTrace();
+ }
synchronized (this) {
return mExtraInfo;
}
project packages/modules/Wifi/
diff --git a/framework/java/android/net/wifi/WifiInfo.java b/framework/java/android/net/wifi/WifiInfo.java
index 8b99294361..b2ce04756d 100644
--- a/framework/java/android/net/wifi/WifiInfo.java
+++ b/framework/java/android/net/wifi/WifiInfo.java
@@ -38,6 +38,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
+import android.util.Log;
import androidx.annotation.RequiresApi;
@@ -71,6 +72,7 @@ import java.util.Objects;
*/
public class WifiInfo implements TransportInfo, Parcelable {
private static final String TAG = "WifiInfo";
+ private static final String TAG_CFM880 = "WifiInfo_CFM880";
/**
* This is the map described in the Javadoc comment above. The positions
* of the elements of the array must correspond to the ordinal values
@@ -631,6 +633,11 @@ public class WifiInfo implements TransportInfo, Parcelable {
* @return the SSID.
*/
public String getSSID() {
+ try {
+ throw new Throwable("getSSID()>>>>获取wifi SSID");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
if (mWifiSsid != null) {
String unicode = mWifiSsid.toString();
if (!TextUtils.isEmpty(unicode)) {
@@ -667,6 +674,11 @@ public class WifiInfo implements TransportInfo, Parcelable {
* @return the BSSID, in the form of a six-byte MAC address: {@code XX:XX:XX:XX:XX:XX}
*/
public String getBSSID() {
+ try {
+ throw new Throwable("getBSSID()>>>>获取wifi BSSID");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mBSSID;
}
@@ -851,6 +863,11 @@ public class WifiInfo implements TransportInfo, Parcelable {
Manifest.permission.ACCESS_FINE_LOCATION
})
public String getMacAddress() {
+ try {
+ throw new Throwable("getMacAddress()>>>>获取Mac地址");
+ }catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
return mMacAddress;
}
diff --git a/framework/java/android/net/wifi/WifiManager.java b/framework/java/android/net/wifi/WifiManager.java
index da17f56320..7f92084d81 100644
--- a/framework/java/android/net/wifi/WifiManager.java
+++ b/framework/java/android/net/wifi/WifiManager.java
@@ -120,6 +120,7 @@ import java.util.concurrent.Executor;
public class WifiManager {
private static final String TAG = "WifiManager";
+ private static final String TAG_CFM880 = "WifiManager_CFM880";
// Supplicant error codes:
/**
* The error code if there was a problem authenticating.
@@ -1464,6 +1465,11 @@ public class WifiManager {
@Deprecated
@RequiresPermission(allOf = {ACCESS_FINE_LOCATION, ACCESS_WIFI_STATE})
public List<WifiConfiguration> getConfiguredNetworks() {
+ try {
+ throw new Throwable("getConfiguredNetworks()>>>>获取wifi信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
ParceledListSlice<WifiConfiguration> parceledList =
mService.getConfiguredNetworks(mContext.getOpPackageName(),
@@ -3218,6 +3224,11 @@ public class WifiManager {
*/
@Deprecated
public WifiInfo getConnectionInfo() {
+ try {
+ throw new Throwable("getConnectionInfo()>>>>获取wifi信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getConnectionInfo(mContext.getOpPackageName(),
mContext.getAttributionTag());
@@ -3233,6 +3244,11 @@ public class WifiManager {
* in order to get valid results.
*/
public List<ScanResult> getScanResults() {
+ try {
+ throw new Throwable("getScanResults()>>>>获取wifi信息");
+ } catch (Throwable throwable) {
+ Log.d(TAG_CFM880, Log.getStackTraceString(throwable));
+ }
try {
return mService.getScanResults(mContext.getOpPackageName(),
mContext.getAttributionTag());
@@ -6560,6 +6576,11 @@ public class WifiManager {
@SystemApi
@RequiresPermission(android.Manifest.permission.NETWORK_SETTINGS)
public String[] getFactoryMacAddresses() {
+ try {
+ throw new Throwable("getFactoryMacAddresses");
+ } catch (Throwable throwable) {
+ Log.d(TAG, Log.getStackTraceString(throwable));
+ }
try {
return mService.getFactoryMacAddresses();
} catch (RemoteException e) {
## https://groups.google.com/g/repo-discuss/c/43juvD1qGIQ?pli=1
## Script to patch up diff reated by `repo diff`
if [ -z "$1" ] || [ ! -e "$1" ]; then
echo "Usages: $0 <repo_diff_file>";
exit 0;
fi
rm -fr _tmp_splits*
cat $1 | csplit -qf '' -b "_tmp_splits.%d.diff" - '/^project.*\/$/' '{*}'
working_dir=`pwd`
for proj_diff in `ls _tmp_splits.*.diff`
do
chg_dir=`cat $proj_diff | grep '^project.*\/$' | cut -d " " -f 2`
echo "FILE: $proj_diff $chg_dir"
if [ -e $chg_dir ]; then
( cd $chg_dir; \
cat $working_dir/$proj_diff | grep -v '^project.*\/$' | patch -Np1;);
else
echo "$0: Project directory $chg_dir don't exists.";
fi
done
rm _tmp_splits.*.diff
@CFM880
Copy link
Author

CFM880 commented Feb 2, 2023

Pixel 3xl AOSP android-12.0.0_r34

按这个https://mirrors.bfsu.edu.cn/help/AOSP/ 先下载[aosp-latest.tar](https://mirrors.bfsu.edu.cn/aosp-monthly/aosp-latest.tar)

再解压aosp-latest.tar

repo init -u https://mirrors.bfsu.edu.cn/git/AOSP/platform/manifest -b android-12.0.0_r34 --partial-clone --clone-filter=blob:limit=10M
下载SP1A.210812.016.C2,高通,Google bin驱,解压
https://developers.google.cn/android/drivers#crosshatchsp1a.210812.016.c2

build/envsetup.sh
lunch aosp_crosshatch-userdebug
m
等待编译完成将,将上面两个文件下载下来,放到aosp根目录下
sh ./repo_patch.sh aosp.patch
再全编译
m

等待patch编译完成

adb reboot fastboot
fastboot flashall -w
等待刷机完成

或者直接用我编译好的,链接: https://pan.baidu.com/s/1RbJdK1dF_s1ts2MlHjpIFQ 提取码: sssk
--来自百度网盘超级会员v8的分享
终端切到解压后的目录

export ANDROID_PRODUCT_OUT=`pwd`
adb reboot bootloader
fastboot flashall -w

@CFM880
Copy link
Author

CFM880 commented Feb 2, 2023

合规需要检测的方法,参考https://github.com/zhengjim/camille 里的script.js

@CFM880
Copy link
Author

CFM880 commented Feb 3, 2023

APP运行在该patch上的截图
微信图片_20230203123747

@CFM880
Copy link
Author

CFM880 commented Feb 3, 2023

自己改的话,推荐使用这样改

build/envsetup.sh
lunch aosp_crosshatch-userdebug
m
首次编译完后,运行下面的命令(自动用Android Studio打开 ,frameworks/base,相关依赖也会导入)-p后面是Android Stuido的安装studio.sh所在的目录
aidegen frameworks -is -p '/home/cfm880/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/bin/'

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment