Skip to content

Commit

Permalink
Implement workaround for missing weather permission
Browse files Browse the repository at this point in the history
Will be fixed properly with a future bridge update.
  • Loading branch information
amirzaidi committed May 19, 2019
1 parent 684133e commit c96d243
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit c96d243

Please sign in to comment.