Skip to content

Commit

Permalink
Add smartspace forwarding to Google App
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Aug 19, 2018
1 parent 544e6ea commit adb8f9d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "v1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
21 changes: 21 additions & 0 deletions app/src/pixel/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="amirz.aidlbridge">

<permission
android:name="com.google.android.apps.nexuslauncher.permission.QSB"
android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
android:protectionLevel="signatureOrSystem" />
<uses-permission android:name="com.google.android.apps.nexuslauncher.permission.QSB" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true">

<receiver
android:name=".PixelLauncherBroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.apps.gsa.smartspace.ENABLE_UPDATE" />
<action android:name="com.google.android.apps.gsa.smartspace.CLICK_EVENT" />
<action android:name="com.google.android.apps.gsa.smartspace.EXPIRE_EVENT" />
<action android:name="com.google.android.apps.gsa.smartspace.SETTINGS" />
<action android:name="com.google.android.apps.gsa.weatherwidget.ENABLE_UPDATE" />
<action android:name="com.google.android.apps.gsa.weatherwidget.WEATHER_CLICK" />
<action android:name="com.google.android.systemui.smartspace.CLICK_EVENT" />
<action android:name="com.google.android.systemui.smartspace.EXPIRE_EVENT" />
</intent-filter>
</receiver>

<receiver
android:name=".OPAStatusReceiver"
android:permission="android.permission.CAPTURE_AUDIO_HOTWORD">
Expand Down
4 changes: 4 additions & 0 deletions app/src/pixel/java/amirz/aidlbridge/Forwarder.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.util.Log;

public abstract class Forwarder extends BroadcastReceiver {
private static final String TAG = "Forwarder";

@Override
public void onReceive(Context context, Intent intent) {
Intent i = (Intent) intent.clone();
Expand All @@ -18,6 +21,7 @@ public void onReceive(Context context, Intent intent) {
if (ai != null) {
String packageName = ai.packageName;
if (packageName != null && !BuildConfig.APPLICATION_ID.equals(packageName)) {
Log.w(TAG, "Sending " + i.getAction() + " to " + packageName);
i.setPackage(packageName);
context.sendBroadcast(i);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package amirz.aidlbridge;

public class PixelLauncherBroadcastReceiver extends Forwarder {
}

0 comments on commit adb8f9d

Please sign in to comment.