For some reason SN check cannot run on repackaged managers

This commit is contained in:
topjohnwu 2018-04-29 14:40:42 +08:00
parent e5638e4b15
commit 8990919dab
4 changed files with 15 additions and 2 deletions

View File

@ -7,6 +7,7 @@ import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.CardView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -92,7 +93,14 @@ public class MagiskFragment extends Fragment
new CheckSafetyNet(getActivity()).exec();
collapse();
};
if (!CheckSafetyNet.dexPath.exists()) {
if (!TextUtils.equals(mm.getPackageName(), Const.ORIG_PKG_NAME)) {
new AlertDialogBuilder(getActivity())
.setTitle(R.string.cannot_check_sn_title)
.setMessage(R.string.cannot_check_sn_notice)
.setCancelable(true)
.setPositiveButton(R.string.ok, null)
.show();
} else if (!CheckSafetyNet.dexPath.exists()) {
// Show dialog
new AlertDialogBuilder(getActivity())
.setTitle(R.string.proprietary_title)

View File

@ -3,6 +3,7 @@ package com.topjohnwu.magisk.utils;
import android.os.Environment;
import android.os.Process;
import com.topjohnwu.magisk.BuildConfig;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.superuser.io.SuFile;
@ -13,7 +14,7 @@ import java.util.List;
public class Const {
public static final String DEBUG_TAG = "MagiskManager";
public static final String ORIG_PKG_NAME = "com.topjohnwu.magisk";
public static final String ORIG_PKG_NAME = BuildConfig.APPLICATION_ID;
public static final String SNET_PKG = "com.topjohnwu.snet";
public static final String MAGISKHIDE_PROP = "persist.magisk.hide";

View File

@ -219,5 +219,7 @@
<string name="settings_check_update_title">檢查更新</string>
<string name="settings_check_update_summary">在背景定期檢查更新</string>
<string name="disable_fingerprint">沒有指紋加入或是裝置不支援</string>
<string name="cannot_check_sn_title">無法檢查 SafetyNet</string>
<string name="cannot_check_sn_notice">由於一些 Google Play Service 的改變,重新包裝過的 Magisk Manager 無法進行 SafetyNet 檢查。</string>
</resources>

View File

@ -123,6 +123,8 @@
<string name="proprietary_title">Download Proprietary Code</string>
<string name="proprietary_notice">Magisk Manager is FOSS, which doesn\'t contain Google\'s proprietary SafetyNet API code.\n\nDo you allow Magisk Manager to download an extension (contains GoogleApiClient) for SafetyNet checks?</string>
<string name="su_db_corrupt">SU database is corrupted, will recreate new db</string>
<string name="cannot_check_sn_title">Cannot check SafetyNet</string>
<string name="cannot_check_sn_notice">Due to some changes in Google Play Services, it is not possible to check SafetyNet on repackaged Magisk Manager</string>
<!--Settings Activity -->
<string name="settings_general_category">General</string>