Switch from AIDL Bridge to Rootless Pixel Bridge support

This commit is contained in:
Amir Zaidi
2018-08-19 19:03:54 +02:00
committed by Kshitij Gupta
parent a9a3c00bc7
commit c0b54f7baf
3 changed files with 14 additions and 5 deletions

View File

@@ -7,8 +7,6 @@ import android.os.IBinder;
import android.util.Log;
public class BaseClientService implements ServiceConnection {
private static final boolean PROXY = true;
private boolean mConnected;
private final Context mContext;
private final int mFlags;
@@ -17,7 +15,7 @@ public class BaseClientService implements ServiceConnection {
BaseClientService(Context context, int flags) {
mContext = context;
mFlags = flags;
mBridge = PROXY
mBridge = LauncherClient.BRIDGE_USE
? new LauncherClientBridge(this)
: this;
}
@@ -25,7 +23,8 @@ public class BaseClientService implements ServiceConnection {
public final boolean connect() {
if (!mConnected) {
try {
mConnected = mContext.bindService(LauncherClient.getIntent(mContext, PROXY), mBridge, mFlags);
mConnected = mContext.bindService(LauncherClient.getIntent(mContext,
LauncherClient.BRIDGE_USE), mBridge, mFlags);
} catch (Throwable e) {
Log.e("LauncherClient", "Unable to connect to overlay service", e);
}

View File

@@ -25,6 +25,9 @@ import com.google.android.libraries.launcherclient.ILauncherOverlayCallback;
import java.lang.ref.WeakReference;
public class LauncherClient {
public final static boolean BRIDGE_USE = true;
public final static String BRIDGE_PACKAGE = "com.google.android.apps.nexuslauncher";
private static int apiVersion = -1;
private ILauncherOverlay mOverlay;
@@ -364,7 +367,7 @@ public class LauncherClient {
static Intent getIntent(Context context, boolean proxy) {
String pkg = context.getPackageName();
return new Intent("com.android.launcher3.WINDOW_OVERLAY")
.setPackage(proxy ? "amirz.aidlbridge" : "com.google.android.googlequicksearchbox")
.setPackage(proxy ? BRIDGE_PACKAGE : "com.google.android.googlequicksearchbox")
.setData(Uri.parse(new StringBuilder(pkg.length() + 18)
.append("app://")
.append(pkg)

7
res/values/bridge.xml Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="bridge_signature_hash">0xB662CC2F</integer>
<string name="bridge_download_url" translatable="false">https://github.com/amirzaidi/AIDLBridge/releases/download</string>
<string name="bridge_download_version" translatable="false">v1</string>
<string name="bridge_download_file" translatable="false">pixelbridge.apk</string>
</resources>