aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2017-01-23 23:50:06 +0100
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-02-18 12:21:04 +0800
commit61b22b3ccab592baa4912424b748d4c4ade48173 (patch)
tree8c7aa6b138f9102879b3f92b3a81bab909d7abc6 /src
parent702ac03e98956b9b9b359dc15d34ca3c99c27baf (diff)
downloadandroid_packages_apps_LockClock-61b22b3ccab592baa4912424b748d4c4ade48173.tar.gz
android_packages_apps_LockClock-61b22b3ccab592baa4912424b748d4c4ade48173.tar.bz2
android_packages_apps_LockClock-61b22b3ccab592baa4912424b748d4c4ade48173.zip
Remove Google Play Services dependency
PS2: Use PackageManagerUtils PS3: remove unused import and inline pm call Change-Id: I9efe77beb9121d97d975ab9d5cbb58fba14e2256
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
index 1fd6f70..f5254ca 100644
--- a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
+++ b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
@@ -44,12 +44,13 @@ import com.cyanogenmod.lockclock.misc.Constants;
import com.cyanogenmod.lockclock.misc.Preferences;
import com.cyanogenmod.lockclock.misc.WidgetUtils;
import com.cyanogenmod.lockclock.preference.WeatherPreferences;
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesUtil;
+
import cyanogenmod.weather.CMWeatherManager;
import cyanogenmod.weather.WeatherInfo;
import cyanogenmod.weather.WeatherLocation;
+import org.cyanogenmod.internal.util.PackageManagerUtils;
+
import java.lang.ref.WeakReference;
import java.util.Date;
@@ -344,7 +345,7 @@ public class WeatherUpdateService extends Service {
String locationProvider = lm.getBestProvider(sLocationCriteria, true);
if (TextUtils.isEmpty(locationProvider)) {
Log.e(TAG, "No available location providers matching criteria.");
- } else if (isGooglePlayServicesAvailable()
+ } else if (PackageManagerUtils.isAppInstalled(mContext, "com.google.android.gms")
&& locationProvider.equals(LocationManager.GPS_PROVIDER)) {
// Since Google Play services is available,
// let's conserve battery power and not depend on the device's GPS.
@@ -356,12 +357,6 @@ public class WeatherUpdateService extends Service {
return location;
}
- private boolean isGooglePlayServicesAvailable() {
- int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext);
- return result == ConnectionResult.SUCCESS
- || result == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED;
- }
-
private void onWeatherRequestCompleted(WeatherInfo result) {
if (D) Log.d(TAG, "Weather update received, caching data and updating widget");
cancelTimeoutAlarm();