summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2015-06-20 00:46:03 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-20 00:46:04 +0000
commitb3add4dae22076d35c2c2fb9f150a69382356598 (patch)
tree8483b1659a726b2755aa49cacde66c36b27d68de
parentce49be7ee6cfcbf15e0e4d8975e58f6ed6916006 (diff)
parent98b7f8943080ff4b0c636ad37b62556453018839 (diff)
downloadframeworks_base-b3add4dae22076d35c2c2fb9f150a69382356598.zip
frameworks_base-b3add4dae22076d35c2c2fb9f150a69382356598.tar.gz
frameworks_base-b3add4dae22076d35c2c2fb9f150a69382356598.tar.bz2
Merge "Fix regression in viewing app info from ChooserActivity targets" into mnc-dev
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java42
-rw-r--r--core/java/com/android/internal/logging/MetricsLogger.java4
2 files changed, 46 insertions, 0 deletions
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 2a13c76..678e92b 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -50,11 +50,13 @@ import android.util.Slog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import com.android.internal.R;
+import com.android.internal.logging.MetricsLogger;
import java.util.ArrayList;
import java.util.List;
@@ -185,6 +187,8 @@ public class ChooserActivity extends ResolverActivity {
setSafeForwardingMode(true);
super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents,
null, false);
+
+ MetricsLogger.action(this, MetricsLogger.ACTION_ACTIVITY_CHOOSER_SHOWN);
}
@Override
@@ -291,6 +295,36 @@ public class ChooserActivity extends ResolverActivity {
return super.onTargetSelected(target, alwaysCheck);
}
+ @Override
+ void startSelected(int which, boolean always, boolean filtered) {
+ super.startSelected(which, always, filtered);
+
+ if (mChooserListAdapter != null) {
+ // Log the index of which type of target the user picked.
+ // Lower values mean the ranking was better.
+ int cat = 0;
+ int value = which;
+ switch (mChooserListAdapter.getPositionTargetType(which)) {
+ case ChooserListAdapter.TARGET_CALLER:
+ cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET;
+ break;
+ case ChooserListAdapter.TARGET_SERVICE:
+ cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET;
+ value -= mChooserListAdapter.getCallerTargetCount();
+ break;
+ case ChooserListAdapter.TARGET_STANDARD:
+ cat = MetricsLogger.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET;
+ value -= mChooserListAdapter.getCallerTargetCount()
+ + mChooserListAdapter.getServiceTargetCount();
+ break;
+ }
+
+ if (cat != 0) {
+ MetricsLogger.action(this, cat, value);
+ }
+ }
+ }
+
void queryTargetServices(ChooserListAdapter adapter) {
final PackageManager pm = getPackageManager();
int targetsToQuery = 0;
@@ -851,6 +885,14 @@ public class ChooserActivity extends ResolverActivity {
startSelected(itemIndex, false, true);
}
});
+ v.setOnLongClickListener(new OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ showAppDetails(
+ mChooserListAdapter.resolveInfoForPosition(itemIndex, true));
+ return true;
+ }
+ });
} else {
v.setVisibility(View.GONE);
}
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index 03f2e3a..e4ccb4b 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -33,6 +33,10 @@ public class MetricsLogger implements MetricsConstants {
public static final int ACTION_VOLUME_KEY = 211;
public static final int ACTION_VOLUME_ICON = 212;
public static final int ACTION_RINGER_MODE = 213;
+ public static final int ACTION_ACTIVITY_CHOOSER_SHOWN = 214;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET = 215;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET = 216;
+ public static final int ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET = 217;
// Temporary constants go here, to await migration to MetricsConstants.
public static void visible(Context context, int category) throws IllegalArgumentException {