Adding referrer information when launching market intent
Bug: 72331091 Change-Id: I75ed764fd9964b58de97c287b8a26d24a0caa3fc
This commit is contained in:
parent
08af6b7984
commit
67e75e20cc
|
@ -70,7 +70,7 @@ public class InfoDropTarget extends UninstallDropTarget {
|
|||
Rect sourceBounds, Bundle opts) {
|
||||
if (info instanceof PromiseAppInfo) {
|
||||
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
|
||||
context.startActivity(promiseAppInfo.getMarketIntent());
|
||||
context.startActivity(promiseAppInfo.getMarketIntent(context));
|
||||
return null;
|
||||
}
|
||||
ComponentName componentName = null;
|
||||
|
|
|
@ -1739,7 +1739,7 @@ public class Launcher extends BaseActivity
|
|||
|
||||
private void startMarketIntentForPackage(View v, String packageName) {
|
||||
ItemInfo item = (ItemInfo) v.getTag();
|
||||
Intent intent = PackageManagerHelper.getMarketIntent(packageName);
|
||||
Intent intent = new PackageManagerHelper(v.getContext()).getMarketIntent(packageName);
|
||||
startActivitySafely(v, intent, item);
|
||||
}
|
||||
|
||||
|
@ -1804,7 +1804,7 @@ public class Launcher extends BaseActivity
|
|||
Intent intent;
|
||||
if (item instanceof PromiseAppInfo) {
|
||||
PromiseAppInfo promiseAppInfo = (PromiseAppInfo) item;
|
||||
intent = promiseAppInfo.getMarketIntent();
|
||||
intent = promiseAppInfo.getMarketIntent(this);
|
||||
} else {
|
||||
intent = item.getIntent();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
|
@ -46,7 +47,7 @@ public class PromiseAppInfo extends AppInfo {
|
|||
return shortcut;
|
||||
}
|
||||
|
||||
public Intent getMarketIntent() {
|
||||
return PackageManagerHelper.getMarketIntent(componentName.getPackageName());
|
||||
public Intent getMarketIntent(Context context) {
|
||||
return new PackageManagerHelper(context).getMarketIntent(componentName.getPackageName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ public abstract class SystemShortcut extends ItemInfo {
|
|||
|
||||
public View.OnClickListener createOnClickListener(Launcher launcher, ItemInfo itemInfo) {
|
||||
return view -> {
|
||||
Intent intent = PackageManagerHelper.getMarketIntent(itemInfo
|
||||
.getTargetComponent().getPackageName());
|
||||
Intent intent = new PackageManagerHelper(view.getContext()).getMarketIntent(
|
||||
itemInfo.getTargetComponent().getPackageName());
|
||||
launcher.startActivitySafely(view, intent, itemInfo);
|
||||
AbstractFloatingView.closeAllOpenViews(launcher);
|
||||
};
|
||||
|
|
|
@ -143,13 +143,15 @@ public class PackageManagerHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static Intent getMarketIntent(String packageName) {
|
||||
public Intent getMarketIntent(String packageName) {
|
||||
return new Intent(Intent.ACTION_VIEW)
|
||||
.setData(new Uri.Builder()
|
||||
.scheme("market")
|
||||
.authority("details")
|
||||
.appendQueryParameter("id", packageName)
|
||||
.build());
|
||||
.build())
|
||||
.putExtra(Intent.EXTRA_REFERRER, new Uri.Builder().scheme("android-app")
|
||||
.authority(mContext.getPackageName()).build());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue