Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
b8eaff66
Commit
b8eaff66
authored
Jul 28, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shrink snet APK, and prevent crashing
parent
a747fdd2
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
23 deletions
+28
-23
Const.java
app/src/main/java/com/topjohnwu/magisk/utils/Const.java
+2
-2
build.gradle
snet/build.gradle
+5
-2
proguard-rules.pro
snet/proguard-rules.pro
+2
-1
ModdedGPSUtil.java
snet/src/main/java/com/topjohnwu/snet/ModdedGPSUtil.java
+16
-13
SafetyNetHelper.java
snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java
+3
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/Const.java
View file @
b8eaff66
...
...
@@ -39,7 +39,7 @@ public class Const {
// Versions
public
static
final
int
UPDATE_SERVICE_VER
=
1
;
public
static
final
int
SNET_VER
=
9
;
public
static
final
int
SNET_VER
=
10
;
public
static
int
MIN_MODULE_VER
()
{
return
MagiskManager
.
get
().
magiskVersionCode
>=
MAGISK_VER
.
REMOVE_LEGACY_LINK
?
1500
:
1400
;
...
...
@@ -81,7 +81,7 @@ public class Const {
public
static
class
Url
{
public
static
final
String
STABLE_URL
=
"https://raw.githubusercontent.com/topjohnwu/magisk_files/master/stable.json"
;
public
static
final
String
BETA_URL
=
"https://raw.githubusercontent.com/topjohnwu/magisk_files/master/beta.json"
;
public
static
final
String
SNET_URL
=
"https://github.com/topjohnwu/magisk_files/raw/
fc819e3974e96d0e4430a2957df4410971ebd6f3
/snet.apk"
;
public
static
final
String
SNET_URL
=
"https://github.com/topjohnwu/magisk_files/raw/
a300521162587da23e45010797bfd8c9a03594f6
/snet.apk"
;
public
static
final
String
REPO_URL
=
"https://api.github.com/users/Magisk-Modules-Repo/repos?per_page=100&page=%d"
;
public
static
final
String
FILE_URL
=
"https://raw.githubusercontent.com/Magisk-Modules-Repo/%s/master/%s"
;
public
static
final
String
ZIP_URL
=
"https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"
;
...
...
snet/build.gradle
View file @
b8eaff66
...
...
@@ -16,12 +16,15 @@ android {
release
{
minifyEnabled
true
shrinkResources
true
proguardFiles
getDefaultProguardFile
(
'proguard-android
-optimize
.txt'
),
'proguard-rules.pro'
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
}
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'com.google.android.gms:play-services-safetynet:7.0.0'
/* The oldest version */
/* The oldest version */
implementation
(
'com.google.android.gms:play-services-safetynet:7.0.0'
)
{
exclude
module:
'support-v4'
}
}
snet/proguard-rules.pro
View file @
b8eaff66
...
...
@@ -20,6 +20,7 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-
keep
class
com
.
topjohnwu
.
snet
.
*
{
*
;
}
-
ignorewarnings
-
keep
class
com
.
topjohnwu
.
snet
.
Snet
{
*
;
}
-
dontwarn
java
.
lang
.
invoke
**
-
dontwarn
com
.
google
.
android
.
gms
.
common
.
GooglePlayServicesUtil
**
snet/src/main/java/com/topjohnwu/snet/ModdedGPSUtil.java
View file @
b8eaff66
...
...
@@ -5,13 +5,14 @@ import android.app.AlertDialog;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.ContextWrapper
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.res.AssetManager
;
import
android.content.res.Resources
;
import
android.util.Log
;
import
com.google.android.gms.common.GooglePlayServicesUtil
;
import
com.google.android.gms.common.internal.zzg
;
import
com.google.android.gms.internal.zzlu
;
/* Decompiled and modified from GooglePlayServiceUtil.class */
...
...
@@ -20,7 +21,7 @@ public class ModdedGPSUtil {
private
static
final
String
TAG
=
"GooglePlayServicesUtil"
;
static
String
dexPath
;
static
Dialog
getErrorDialog
(
int
errCode
,
Activity
activity
,
int
requestCode
)
{
static
Dialog
getErrorDialog
(
int
errCode
,
final
Activity
activity
,
final
int
requestCode
)
{
SwapResContext
ctx
=
new
SwapResContext
(
activity
,
dexPath
);
Resources
res
=
ctx
.
getResources
();
if
(
zzlu
.
zzQ
(
ctx
)
&&
errCode
==
2
)
{
...
...
@@ -33,8 +34,16 @@ public class ModdedGPSUtil {
String
btnMsg
=
GooglePlayServicesUtil
.
zzf
(
ctx
,
errCode
);
if
(
btnMsg
!=
null
)
{
Intent
intent
=
GooglePlayServicesUtil
.
zzan
(
errCode
);
builder
.
setPositiveButton
(
btnMsg
,
new
zzg
(
activity
,
intent
,
requestCode
));
final
Intent
intent
=
GooglePlayServicesUtil
.
zzan
(
errCode
);
builder
.
setPositiveButton
(
btnMsg
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
i
)
{
PackageManager
pm
=
activity
.
getPackageManager
();
if
(
intent
!=
null
&&
intent
.
resolveActivity
(
pm
)
!=
null
)
activity
.
startActivityForResult
(
intent
,
requestCode
);
dialog
.
dismiss
();
}
});
}
switch
(
errCode
)
{
...
...
@@ -116,20 +125,14 @@ public class ModdedGPSUtil {
public
SwapResContext
(
Context
base
,
String
apk
)
{
super
(
base
);
asset
=
getAssets
(
apk
);
Resources
res
=
base
.
getResources
();
resources
=
new
Resources
(
asset
,
res
.
getDisplayMetrics
(),
res
.
getConfiguration
());
}
private
AssetManager
getAssets
(
String
apk
)
{
try
{
AssetManager
asset
=
AssetManager
.
class
.
newInstance
();
asset
=
AssetManager
.
class
.
newInstance
();
AssetManager
.
class
.
getMethod
(
"addAssetPath"
,
String
.
class
).
invoke
(
asset
,
apk
);
return
asset
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
Resources
res
=
base
.
getResources
();
resources
=
new
Resources
(
asset
,
res
.
getDisplayMetrics
(),
res
.
getConfiguration
());
}
@Override
...
...
snet/src/main/java/com/topjohnwu/snet/SafetyNetHelper.java
View file @
b8eaff66
...
...
@@ -2,8 +2,6 @@ package com.topjohnwu.snet;
import
android.app.Activity
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.annotation.Nullable
;
import
android.util.Base64
;
import
com.google.android.gms.common.ConnectionResult
;
...
...
@@ -31,7 +29,7 @@ public class SafetyNetHelper implements InvocationHandler, GoogleApiClient.Conne
public
static
final
int
BASIC_PASS
=
0x10
;
public
static
final
int
CTS_PASS
=
0x20
;
public
static
final
int
SNET_EXT_VER
=
9
;
public
static
final
int
SNET_EXT_VER
=
10
;
private
GoogleApiClient
mGoogleApiClient
;
private
Activity
mActivity
;
...
...
@@ -81,14 +79,14 @@ public class SafetyNetHelper implements InvocationHandler, GoogleApiClient.Conne
}
@Override
public
void
onConnectionFailed
(
@NonNull
ConnectionResult
result
)
{
public
void
onConnectionFailed
(
ConnectionResult
result
)
{
if
(
GooglePlayServicesUtil
.
isUserRecoverableError
(
result
.
getErrorCode
()))
ModdedGPSUtil
.
getErrorDialog
(
result
.
getErrorCode
(),
mActivity
,
0
).
show
();
invokeCallback
(
CONNECTION_FAIL
);
}
@Override
public
void
onConnected
(
@Nullable
Bundle
bundle
)
{
public
void
onConnected
(
Bundle
bundle
)
{
// Create nonce
byte
[]
nonce
=
new
byte
[
24
];
new
SecureRandom
().
nextBytes
(
nonce
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment