-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* That will spoof build fingerprints on some g00gle apps * Thanks to @kdrag0n for the original idea at ProtonAOSP/android_frameworks_base@5a54bfd @neobuddy89: * Squash subsequent changes by jhenrique09 Signed-off-by: jhenrique09 <jhenrique09.mcz@hotmail.com> Co-authored-by: Danny Lin <danny@kdrag0n.dev> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
- Loading branch information
1 parent
1daa4bc
commit 5eb8ec3
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
core/java/com/android/internal/util/crdroid/PixelPropsUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright (C) 2020 The Pixel Experience Project | ||
* 2021 crDroid Android Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.android.internal.util.crdroid; | ||
|
||
import android.os.Build; | ||
import android.util.Log; | ||
|
||
import java.util.Arrays; | ||
import java.lang.reflect.Field; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class PixelPropsUtils { | ||
|
||
private static final String TAG = PixelPropsUtils.class.getSimpleName(); | ||
private static final boolean DEBUG = false; | ||
|
||
private static final Map<String, Object> propsToChange; | ||
|
||
private static final String[] packagesToChange = { | ||
"com.google.android.apps.safetyhub", | ||
"com.google.android.apps.turbo", | ||
"com.google.android.apps.wallpaper", | ||
"com.google.android.apps.maps", | ||
"com.google.android.gms", | ||
"com.google.android.googlequicksearchbox" | ||
}; | ||
|
||
static { | ||
propsToChange = new HashMap<>(); | ||
propsToChange.put("BRAND", "google"); | ||
propsToChange.put("MANUFACTURER", "Google"); | ||
propsToChange.put("DEVICE", "redfin"); | ||
propsToChange.put("PRODUCT", "redfin"); | ||
propsToChange.put("MODEL", "Pixel 5"); | ||
propsToChange.put("FINGERPRINT", "google/redfin/redfin:11/RQ2A.210305.007/7124944:user/release-keys"); | ||
} | ||
|
||
public static void setProps(String packageName) { | ||
if (packageName == null) { | ||
return; | ||
} | ||
if (Arrays.asList(packagesToChange).contains(packageName)) { | ||
if (DEBUG) { | ||
Log.d(TAG, "Defining props for: " + packageName); | ||
} | ||
for (Map.Entry<String, Object> prop : propsToChange.entrySet()) { | ||
String key = prop.getKey(); | ||
Object value = prop.getValue(); | ||
setPropValue(key, value); | ||
} | ||
} | ||
// Set proper indexing fingerprint | ||
if (packageName.equals("com.google.android.settings.intelligence")) { | ||
setPropValue("FINGERPRINT", Build.DATE); | ||
} | ||
} | ||
|
||
private static void setPropValue(String key, Object value) { | ||
try { | ||
if (DEBUG) { | ||
Log.d(TAG, "Defining prop " + key + " to " + value.toString()); | ||
} | ||
Field field = Build.class.getDeclaredField(key); | ||
field.setAccessible(true); | ||
field.set(null, value); | ||
field.setAccessible(false); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
Log.e(TAG, "Failed to set prop " + key, e); | ||
} | ||
} | ||
} |