Commit 176f22b1 authored by mengcuiguang2's avatar mengcuiguang2

代码优化

parent c63a14a1
...@@ -32,10 +32,10 @@ android { ...@@ -32,10 +32,10 @@ android {
} }
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar','*.aar']) // implementation fileTree(dir: 'libs', include: ['*.jar','*.aar'])
// implementation fileTree(dir: 'libs', include: ['*.jar']) // implementation fileTree(dir: 'libs', include: ['*.jar'])
// api 'com.alipay.sdk:alipaysdk-android:+@aar' api 'com.alipay.sdk:alipaysdk-android:+@aar'
implementation 'androidx.core:core-ktx:1.3.2' implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0' implementation 'com.google.android.material:material:1.3.0'
......
...@@ -10,6 +10,8 @@ import android.content.pm.Signature; ...@@ -10,6 +10,8 @@ import android.content.pm.Signature;
import android.util.Log; import android.util.Log;
import com.jobo.alipay.BuildConfig;
import java.util.Arrays; import java.util.Arrays;
class ApplicationContext extends ContextWrapper { class ApplicationContext extends ContextWrapper {
...@@ -59,7 +61,7 @@ class ApplicationContext extends ContextWrapper { ...@@ -59,7 +61,7 @@ class ApplicationContext extends ContextWrapper {
// 这句不是为了DEBUG,千万别删除!!! // 这句不是为了DEBUG,千万别删除!!!
RuntimeException runtimeException = new RuntimeException(); RuntimeException runtimeException = new RuntimeException();
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, "getPackageName() STACK TRACE! called " + Arrays.toString(runtimeException.getStackTrace())); Log.d(TAG, "getPackageName() STACK TRACE! called " + Arrays.toString(runtimeException.getStackTrace()));
/* 破解无奈之举 /* 破解无奈之举
...@@ -72,27 +74,27 @@ class ApplicationContext extends ContextWrapper { ...@@ -72,27 +74,27 @@ class ApplicationContext extends ContextWrapper {
(containsIgnoreCase(stackTrace[1].getMethodName(), "component") (containsIgnoreCase(stackTrace[1].getMethodName(), "component")
|| containsIgnoreCase(stackTrace[1].getClassName(), "component") || containsIgnoreCase(stackTrace[1].getClassName(), "component")
|| containsIgnoreCase(stackTrace[1].getClassName(), "intent"))) { || containsIgnoreCase(stackTrace[1].getClassName(), "intent"))) {
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.w(TAG, "getPackageName: MATCH!! on counter = " + hackIntoCCodeHelperOfCounter); Log.w(TAG, "getPackageName: MATCH!! on counter = " + hackIntoCCodeHelperOfCounter);
result = realPackageName; result = realPackageName;
} }
if (BuildConfig.IS_DEBUG) Log.i(TAG, "getPackageName() called counter = " + hackIntoCCodeHelperOfCounter + " RESULT = " + result, new RuntimeException()); if (BuildConfig.DEBUG) Log.i(TAG, "getPackageName() called counter = " + hackIntoCCodeHelperOfCounter + " RESULT = " + result, new RuntimeException());
return result; return result;
} }
@Override @Override
public PackageManager getPackageManager() { public PackageManager getPackageManager() {
if (BuildConfig.IS_DEBUG) Log.d(TAG, "getPackageManager() called", new RuntimeException()); if (BuildConfig.DEBUG) Log.d(TAG, "getPackageManager() called", new RuntimeException());
return fakePm; return fakePm;
} }
@Override public ApplicationInfo getApplicationInfo() { @Override public ApplicationInfo getApplicationInfo() {
if (BuildConfig.IS_DEBUG) Log.d(TAG, "getApplicationInfo() called", new RuntimeException()); if (BuildConfig.DEBUG) Log.d(TAG, "getApplicationInfo() called", new RuntimeException());
return super.getApplicationInfo(); return super.getApplicationInfo();
} }
@Override public ContentResolver getContentResolver() { @Override public ContentResolver getContentResolver() {
if (BuildConfig.IS_DEBUG) Log.d(TAG, "getContentResolver() called", new RuntimeException()); if (BuildConfig.DEBUG) Log.d(TAG, "getContentResolver() called", new RuntimeException());
return super.getContentResolver(); return super.getContentResolver();
} }
...@@ -101,7 +103,7 @@ class ApplicationContext extends ContextWrapper { ...@@ -101,7 +103,7 @@ class ApplicationContext extends ContextWrapper {
} }
@Override public SharedPreferences getSharedPreferences(String name, int mode) { @Override public SharedPreferences getSharedPreferences(String name, int mode) {
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, "getSharedPreferences() called with: name = [" + name + "], mode = [" + mode + "]"); Log.d(TAG, "getSharedPreferences() called with: name = [" + name + "], mode = [" + mode + "]");
return super.getSharedPreferences(name, mode); return super.getSharedPreferences(name, mode);
......
...@@ -5,20 +5,22 @@ import android.content.pm.PackageManager; ...@@ -5,20 +5,22 @@ import android.content.pm.PackageManager;
import android.content.pm.Signature; import android.content.pm.Signature;
import android.util.Log; import android.util.Log;
import com.jobo.alipay.BuildConfig;
public class Context { public class Context {
private static String pkgName = "com.duben.xixiplaylet"; private static String pkgName = "com.duben.xixiplaylet";
private static String pkgSign = "308203633082024ba0030201020204181c2ccb300d06092a864886f70d01010b05003062310b3009060355040613027a68310f300d06035504081306636a6474627a310f300d06035504071306636a6474627a310f300d060355040a1306636a6474627a310f300d060355040b1306636a6474627a310f300d06035504031306636a6474627a301e170d3233303331343036343631355a170d3438303330373036343631355a3062310b3009060355040613027a68310f300d06035504081306636a6474627a310f300d06035504071306636a6474627a310f300d060355040a1306636a6474627a310f300d060355040b1306636a6474627a310f300d06035504031306636a6474627a30820122300d06092a864886f70d01010105000382010f003082010a02820101008054bc7f8f0781be915f0da76eb2ded42e382028c7b146894b0fccd0b4fbb306c62b2d050f89e07e0c66b737935c655669f7dec88e51577d778b080cddee5aa90d686509c505f07bdba4bc4020b6fde1372c68602e0de1e7a6bcc1bebfe93f625a3802c6b27bb91532590ff3b2d7142f2f97d8d8d547719fe7bf6a0f0dd74774ac5c2fe6b297573b257e82863a23a8ccd04ac8cdc8fb3c387f6d55369ba42ff835b5c6995bb335536fddee08b69ef5652fc53816228c02e8c669003fed1d07416b46bb86aaaa1300e89767535ff3fa33eee54bad9c50bc69c4489a8406e72ebe8df62353536c524b4d2936de3418e89af954f7912432f01492a861ea08a72c690203010001a321301f301d0603551d0e04160414a98babd6de3e6ae067f9f80135dbca23156feacc300d06092a864886f70d01010b050003820101000e3ace706c29ec48b98d88e042986b182d54f0b704b3e0510e0670f75c380bbdc1ddcc3772d4c569138a070a43b078b6ce14bdd79da15372018679936bca96597da08438cdf133e7a08fd52dfa9890548ed9905044e4cdaad1abaa31cf7741462b68bb1e42ae063e6020b5ec53974d835cf8f79ac29dffe504e8b524564c53a971193d48a782992dc91ddbfb8cb4f36220f1f25692054a4ddf343868142d36e7e192bee6cc7b95dd8996d99b116cd8755aeed2abdb8453670bae7a8c0c0a2324ad25534cacc0934b2ec33b073fdd4fd7bf875bd9a36ed79fbced0cbcecfe0d3cbf5c339fb12f7f82ac179328e47b31995d5094819d6f3c66e8a083cff093d37b"; private static String pkgSign = "3082033f30820227a003020102020409ed8b8c300d06092a864886f70d01010b05003050310b3009060355040613026368310b300906035504081302626a310b300906035504071302626a310b3009060355040a13026d63310b3009060355040b13026d63310d300b060355040313046d656e67301e170d3233303732343032323930365a170d3437303731383032323930365a3050310b3009060355040613026368310b300906035504081302626a310b300906035504071302626a310b3009060355040a13026d63310b3009060355040b13026d63310d300b060355040313046d656e6730820122300d06092a864886f70d01010105000382010f003082010a02820101009ad76a513f7a2963ffb16e0fa9c545ef5ad15411b3a922ad373e51c62b784a06d096c5139b8a7bf80e9dcca3f8c8af7db9a1eb8e63758de8e5c33d53340c7970f2a7d4ff621000cd4d54bb56bf24877688b028615b9a60792df9142692a3c4a1784e583190488ad0003901f212ffe260981f1e0e1f3018699eaafda91a67d7bc7ba737f4264970a24a39bb10f86c716c8e1efd2013ea20c1d44eebb02556a15fb1f408cbaffe0a07288222447033281795e714b94648b31ede9640421b44788db6a3021b0e39252132268a44d7487ac4010a2646b030da5f7e8ba3d9f2280186b0f6f5b31252edc311b1de16decb790a7679b39bd74d066d18bb84843543c7cd0203010001a321301f301d0603551d0e041604149be1e0abe7b14f8a1b6b313481f8113395b49bce300d06092a864886f70d01010b05000382010100636882b5978943d75ed6ff6f261ff962e924d61994dd8b1d8db005e55329f16c19652a8197450b7583d8d09932c7052c8f93d59c25c141c74b7bfa9db3baa06e8f58e06251448e25352ba73fb287426cd3721cc833c53c6beaac2261b6df404cb2622e82729acbf5f824b75a0c832eed2564fb375eace7626a5de2aa7de82c6e2f3876f86033090fef102587de41a179985dd9a62c69896ace0890e7bc89a1be607ba0765f8558c23245f227ce441cea4ea98083c88cbfc0370a5d300a1aee49fdba4645804fc1611d275dd3aa3e9184e04dca236024464cc658694cbb6f8d4d95b964d9ee13ba67f3e88a0f24f2d378e3a03e2ffc592832f7bc0e1f8c39bd97";
public static PackageManager getPackageManager(android.content.Context context) { public static PackageManager getPackageManager(android.content.Context context) {
if (BuildConfig.IS_DEBUG) { if (BuildConfig.DEBUG) {
Log.i("kzhu", "11111:getPackageManager执行"); Log.i("kzhu", "11111:getPackageManager执行");
} }
return new PackageManager2(createContext(context), context); return new PackageManager2(createContext(context), context);
} }
public static String getPackageName(android.content.Context context){ public static String getPackageName(android.content.Context context){
if (BuildConfig.IS_DEBUG) { if (BuildConfig.DEBUG) {
Log.i("kzhu", "11111:getPackageName执行"); Log.i("kzhu", "11111:getPackageName执行");
} }
return pkgName; return pkgName;
......
...@@ -8,6 +8,8 @@ import android.content.pm.Signature; ...@@ -8,6 +8,8 @@ import android.content.pm.Signature;
import android.util.Log; import android.util.Log;
import com.jobo.alipay.BuildConfig;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
class PackageManager2 extends AbsPackageManager { class PackageManager2 extends AbsPackageManager {
...@@ -34,7 +36,7 @@ class PackageManager2 extends AbsPackageManager { ...@@ -34,7 +36,7 @@ class PackageManager2 extends AbsPackageManager {
} else { } else {
result = basePm.getApplicationLabel(info); result = basePm.getApplicationLabel(info);
} }
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.v(TAG, "getApplicationLabel() returned: " +result, new RuntimeException()); Log.v(TAG, "getApplicationLabel() returned: " +result, new RuntimeException());
return result; return result;
} }
...@@ -43,14 +45,14 @@ class PackageManager2 extends AbsPackageManager { ...@@ -43,14 +45,14 @@ class PackageManager2 extends AbsPackageManager {
@Override @Override
public PackageInfo getPackageInfo(@NotNull String packageName, int flags) public PackageInfo getPackageInfo(@NotNull String packageName, int flags)
throws NameNotFoundException { throws NameNotFoundException {
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.v( Log.v(
TAG, TAG,
"getPackageInfo11A() called with: packageName = [" + packageName + "], flags = [" + flags + "], appContextWrapper.fakePackageName = " + appContextWrapper.fakePackageName, "getPackageInfo11A() called with: packageName = [" + packageName + "], flags = [" + flags + "], appContextWrapper.fakePackageName = " + appContextWrapper.fakePackageName,
new RuntimeException() new RuntimeException()
); );
if (appContextWrapper.fakePackageName.equals(packageName)) { if (appContextWrapper.fakePackageName.equals(packageName)) {
if (BuildConfig.IS_DEBUG) Log.e(TAG, "getPackageInfo: FAKING..."); if (BuildConfig.DEBUG) Log.e(TAG, "getPackageInfo: FAKING...");
PackageInfo result = basePm.getPackageInfo(baseContext.getPackageName(), flags); PackageInfo result = basePm.getPackageInfo(baseContext.getPackageName(), flags);
result.packageName = appContextWrapper.fakePackageName; result.packageName = appContextWrapper.fakePackageName;
result.versionName = appContextWrapper.fakeVersionName; result.versionName = appContextWrapper.fakeVersionName;
...@@ -63,7 +65,7 @@ class PackageManager2 extends AbsPackageManager { ...@@ -63,7 +65,7 @@ class PackageManager2 extends AbsPackageManager {
@Override @Override
public PackageInfo getPackageArchiveInfo(@NotNull String archiveFilePath, int flags) { public PackageInfo getPackageArchiveInfo(@NotNull String archiveFilePath, int flags) {
if (BuildConfig.IS_DEBUG) Log.v( if (BuildConfig.DEBUG) Log.v(
TAG, TAG,
"getPackageArchiveInfo() called with: archiveFilePath = [" + archiveFilePath + "], flags = [" + flags + "]", "getPackageArchiveInfo() called with: archiveFilePath = [" + archiveFilePath + "], flags = [" + flags + "]",
new RuntimeException() new RuntimeException()
...@@ -74,7 +76,7 @@ class PackageManager2 extends AbsPackageManager { ...@@ -74,7 +76,7 @@ class PackageManager2 extends AbsPackageManager {
@NotNull @NotNull
@Override @Override
public ApplicationInfo getApplicationInfo(@NotNull String packageName, int flags) throws NameNotFoundException { public ApplicationInfo getApplicationInfo(@NotNull String packageName, int flags) throws NameNotFoundException {
if (BuildConfig.IS_DEBUG) if (BuildConfig.DEBUG)
Log.d(TAG, "getApplicationInfo() called with: packageName = [" + packageName + "], flags = [" + flags + "]"); Log.d(TAG, "getApplicationInfo() called with: packageName = [" + packageName + "], flags = [" + flags + "]");
return super.getApplicationInfo(packageName, flags); return super.getApplicationInfo(packageName, flags);
......
...@@ -17,6 +17,7 @@ import com.duben.xixiplaylet.ui.fragment.base.LazyLoadBaseFragment ...@@ -17,6 +17,7 @@ import com.duben.xixiplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener import com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
import com.duben.xixiplaylet.common.AppConfig import com.duben.xixiplaylet.common.AppConfig
import com.duben.xixiplaylet.common.DeviceInfo
import com.duben.xixiplaylet.manager.UserManager import com.duben.xixiplaylet.manager.UserManager
import com.duben.xixiplaylet.ui.adapter.NewHotStyleAdapter import com.duben.xixiplaylet.ui.adapter.NewHotStyleAdapter
import com.duben.xixiplaylet.utils.CommonUtils import com.duben.xixiplaylet.utils.CommonUtils
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment