|
|
|
|
@ -3,6 +3,7 @@ package com.fongmi.android.tv; |
|
|
|
|
import android.app.Activity; |
|
|
|
|
import android.app.Application; |
|
|
|
|
import android.content.Context; |
|
|
|
|
import android.content.pm.PackageManager; |
|
|
|
|
import android.os.Bundle; |
|
|
|
|
import android.os.Handler; |
|
|
|
|
import android.os.Looper; |
|
|
|
|
@ -11,6 +12,7 @@ import androidx.annotation.NonNull; |
|
|
|
|
import androidx.annotation.Nullable; |
|
|
|
|
import androidx.core.os.HandlerCompat; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.api.LiveConfig; |
|
|
|
|
import com.fongmi.android.tv.ui.activity.CrashActivity; |
|
|
|
|
import com.fongmi.android.tv.utils.Notify; |
|
|
|
|
import com.github.catvod.Init; |
|
|
|
|
@ -34,6 +36,7 @@ public class App extends Application { |
|
|
|
|
private static App instance; |
|
|
|
|
private Activity activity; |
|
|
|
|
private final Gson gson; |
|
|
|
|
private boolean hook; |
|
|
|
|
|
|
|
|
|
public App() { |
|
|
|
|
instance = this; |
|
|
|
|
@ -79,6 +82,10 @@ public class App extends Application { |
|
|
|
|
this.activity = activity; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setHook(boolean hook) { |
|
|
|
|
this.hook = hook; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void attachBaseContext(Context base) { |
|
|
|
|
super.attachBaseContext(base); |
|
|
|
|
@ -129,6 +136,18 @@ public class App extends Application { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public PackageManager getPackageManager() { |
|
|
|
|
if (!hook) return getBaseContext().getPackageManager(); |
|
|
|
|
return LiveConfig.get().getHome().getCore().getPackageManager(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getPackageName() { |
|
|
|
|
if (!hook) return getBaseContext().getPackageName(); |
|
|
|
|
return LiveConfig.get().getHome().getCore().getPkg(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private LogAdapter getLogAdapter() { |
|
|
|
|
return new AndroidLogAdapter(PrettyFormatStrategy.newBuilder().showThreadInfo(false).tag("").build()) { |
|
|
|
|
@Override |
|
|
|
|
|