[Android] Disable Search feature on TV if not supported

Geoffrey Métais git at videolan.org
Mon Feb 8 17:17:13 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb  8 16:19:22 2016 +0100| [28ace5f16a915d923de4a469f49b8178f8df0266] | committer: Geoffrey Métais

Disable Search feature on TV if not supported

Previously we blacklisted amazon devices, this is more generic

> https://code.videolan.org/videolan/vlc-android/commit/28ace5f16a915d923de4a469f49b8178f8df0266
---

 vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 2b4fc60..6f53f26 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -144,11 +144,14 @@ public class MainTvActivity extends BaseTvActivity implements IVideoBrowser, OnI
         mBrowseFragment.setOnItemViewClickedListener(this);
         mBrowseFragment.setOnItemViewSelectedListener(this);
 
-        if (!Build.MANUFACTURER.equalsIgnoreCase("amazon")) { //Hide search for Amazon Fire TVs
+        //Enable search feature only if we detect Google Play Services.
+        try {
+            getPackageManager().getPackageInfo("com.google.android.gsf", PackageManager.GET_SERVICES);
             mBrowseFragment.setOnSearchClickedListener(this);
             // set search icon color
             mBrowseFragment.setSearchAffordanceColor(getResources().getColor(R.color.orange500));
-        }
+        } catch (PackageManager.NameNotFoundException e) {}
+
         mRootContainer = mBrowseFragment.getView();
     }
 



More information about the Android mailing list