From c96d2433b70a7b7881cd8dfe2227a191d7897274 Mon Sep 17 00:00:00 2001 From: Amir Zaidi Date: Thu, 11 Apr 2019 13:52:56 +0200 Subject: [PATCH] Implement workaround for missing weather permission Will be fixed properly with a future bridge update. --- .../smartspace/SmartspaceCard.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/com/google/android/apps/nexuslauncher/smartspace/SmartspaceCard.java b/src/com/google/android/apps/nexuslauncher/smartspace/SmartspaceCard.java index 0f45f20252..a82b83ee3e 100644 --- a/src/com/google/android/apps/nexuslauncher/smartspace/SmartspaceCard.java +++ b/src/com/google/android/apps/nexuslauncher/smartspace/SmartspaceCard.java @@ -1,5 +1,6 @@ package com.google.android.apps.nexuslauncher.smartspace; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.res.Resources; @@ -10,6 +11,7 @@ import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; +import android.net.Uri; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -304,7 +306,23 @@ void click(View view) { break; } case 2: { - launcher.startActivitySafely(view, intent, null); + try { + Intent internal = Intent.parseUri( + intent.getExtras().getString("com.google.android.apps.gsa.smartspace.extra.SMARTSPACE_INTENT"), + Intent.URI_INTENT_SCHEME); + + ComponentName velvet = new ComponentName("com.google.android.googlequicksearchbox", + "com.google.android.apps.gsa.velour.dynamichosts.VelvetDynamicHostActivity"); + if (velvet.equals(internal.getComponent())) { + internal.setComponent(new ComponentName("com.google.android.googlequicksearchbox", + "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")); + } + + launcher.startActivitySafely(view, internal, null); + } catch (URISyntaxException | NullPointerException | SecurityException e) { + e.printStackTrace(); + launcher.startActivitySafely(view, intent, null); + } break; } }