From e6759db5f48dc0a2cf879d6eb95be09d569095de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=A3=D8=AD=D9=85=D8=AF=20=D8=A7=D9=84=D9=85=D8=AD=D9=85?= =?UTF-8?q?=D9=88=D8=AF=D9=8A=20=28Ahmed=20El-Mahmoudy=29?= Date: Sun, 26 Jan 2014 00:08:52 +0200 Subject: [PATCH] Fix DashClock build Added patch to disable build against Google Play services --- metadata/net.nurik.roman.dashclock.txt | 7 +- .../net.nurik.roman.dashclock/code_26.patch | 14 ++ .../disable_gplay.diff | 176 ++++++++++++++++++ 3 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 metadata/net.nurik.roman.dashclock/code_26.patch create mode 100644 metadata/net.nurik.roman.dashclock/disable_gplay.diff diff --git a/metadata/net.nurik.roman.dashclock.txt b/metadata/net.nurik.roman.dashclock.txt index a5d3714872..a19c121c51 100644 --- a/metadata/net.nurik.roman.dashclock.txt +++ b/metadata/net.nurik.roman.dashclock.txt @@ -41,14 +41,15 @@ cd ../../../ && echo "source.dir=$PWD/main/src/main/java;$PWD/api/src/main/java; $PWD/main/src/main/aidl;$PWD/api/src/main/aidl" >> main/src/main/ant.properties Build:1.6,26 - commit=ba178b86f8b7 + commit=v1.6 subdir=main/src/main target=android-19 + init=touch project.properties forceversion=yes forcevercode=yes extlibs=android/android-support-v13.jar srclibs=1:DragSort@0.6.1 - patch=code_26.patch + patch=code_26.patch;disable_gplay.diff prebuild=cd ../../../ && \ echo "source.dir=$PWD/main/src/main/java;$PWD/api/src/main/java;$PWD/main/src/main/aidl;$PWD/api/src/main/aidl" >> main/src/main/ant.properties @@ -59,7 +60,7 @@ The lack of these makes for an unnecessarily large apk amongst other possible is . Auto Update Mode:None -Update Check Mode:Static +Update Check Mode:Tags Current Version:1.6 Current Version Code:26 diff --git a/metadata/net.nurik.roman.dashclock/code_26.patch b/metadata/net.nurik.roman.dashclock/code_26.patch new file mode 100644 index 0000000000..d2462a853d --- /dev/null +++ b/metadata/net.nurik.roman.dashclock/code_26.patch @@ -0,0 +1,14 @@ +diff --git a/main/src/main/java/com/google/android/apps/dashclock/configuration/ConfigureExtensionsFragment.java b/main/src/main/java/com/google/android/apps/dashclock/configuration/ConfigureExtensionsFragment.java +index a61b785..58979dd 100644 +--- a/main/src/main/java/com/google/android/apps/dashclock/configuration/ConfigureExtensionsFragment.java ++++ b/main/src/main/java/com/google/android/apps/dashclock/configuration/ConfigureExtensionsFragment.java +@@ -183,8 +183,7 @@ public class ConfigureExtensionsFragment extends Fragment implements + } + + return dragSortController.onTouch(view, motionEvent) +- || (!dragSortController.isDragging() +- && mSwipeDismissTouchListener.onTouch(view, motionEvent)); ++ || mSwipeDismissTouchListener.onTouch(view, motionEvent); + + } + }); diff --git a/metadata/net.nurik.roman.dashclock/disable_gplay.diff b/metadata/net.nurik.roman.dashclock/disable_gplay.diff new file mode 100644 index 0000000000..788e8ab83b --- /dev/null +++ b/metadata/net.nurik.roman.dashclock/disable_gplay.diff @@ -0,0 +1,176 @@ +diff --git a/main/src/main/AndroidManifest.xml b/main/src/main/AndroidManifest.xml +index 307e779..d635d22 100755 +diff --git a/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java b/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java +index b9aec91..5119fa2 100644 +--- a/main/src/main/AndroidManifest.xml ++++ b/main/src/main/AndroidManifest.xml +@@ -283,9 +283,6 @@ + + + +- +- + + + +--- a/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java ++++ b/main/src/main/java/com/google/android/apps/dashclock/weather/WeatherExtension.java +@@ -40,10 +40,6 @@ import com.google.android.apps.dashclock.LogUtils; + import com.google.android.apps.dashclock.api.DashClockExtension; + import com.google.android.apps.dashclock.api.ExtensionData; + import com.google.android.apps.dashclock.configuration.AppChooserPreference; +-import com.google.android.gms.common.ConnectionResult; +-import com.google.android.gms.common.GooglePlayServicesUtil; +-import com.google.android.gms.location.LocationClient; +-import com.google.android.gms.location.LocationRequest; + + import net.nurik.roman.dashclock.BuildConfig; + import net.nurik.roman.dashclock.R; +@@ -63,8 +59,6 @@ import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.Lo + import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.getLocationInfo; + import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.getWeatherForLocationInfo; + import static com.google.android.apps.dashclock.weather.YahooWeatherApiClient.setWeatherUnits; +-import static com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks; +-import static com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener; + + /** + * A local weather and forecast extension. +@@ -99,7 +93,6 @@ public class WeatherExtension extends DashClockExtension { + private static final int LOCATION_TIMEOUT_MILLIS = 60 * SECONDS_MILLIS; + + private static final Criteria sLocationCriteria; +- private LocationClient mPlayServicesLocationClient; + + private static String sWeatherUnits = "f"; + private static Intent sWeatherIntent; +@@ -200,96 +193,7 @@ public class WeatherExtension extends DashClockExtension { + + private void tryGooglePlayServicesGetLocationAndPublishWeatherUpdate( + final Runnable errorRunnable) { +- int playServicesResult = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); +- if (playServicesResult != ConnectionResult.SUCCESS) { +- LOGW(TAG, "Google Play Services was unavailable (code " + playServicesResult + ")."); +- if (errorRunnable != null) { +- errorRunnable.run(); +- } +- return; +- } +- +- if (mPlayServicesLocationClient != null) { +- // Already trying to obtain a location. Don't call error runnable since this isn't +- // an error. +- return; +- } +- +- LOGD(TAG, "Getting location using Google Play Services."); +- mPlayServicesLocationClient = new LocationClient(this, new ConnectionCallbacks() { +- @Override +- public void onConnected(Bundle bundle) { +- if (mServiceThreadHandler == null) { +- LOGW(TAG, "Service thread handler empty; can't use Play Services location."); +- mPlayServicesLocationClient.disconnect(); +- mPlayServicesLocationClient = null; +- if (errorRunnable != null) { +- errorRunnable.run(); +- } +- return; +- } +- +- mServiceThreadHandler.post(new Runnable() { +- @Override +- public void run() { +- onHasLocation(); +- } +- }); +- } +- +- private void onHasLocation() { +- final Location lastLocation = mPlayServicesLocationClient.getLastLocation(); +- if (lastLocation == null || (SystemClock.elapsedRealtimeNanos() +- - lastLocation.getElapsedRealtimeNanos()) >= STALE_LOCATION_NANOS) { +- LOGW(TAG, "Stale or missing last-known location; requesting single location " +- + "update."); +- LocationRequest request = LocationRequest.create() +- .setExpirationDuration(LOCATION_TIMEOUT_MILLIS - 1000) +- .setFastestInterval(0) +- .setInterval(0) +- .setNumUpdates(1) +- .setSmallestDisplacement(0) +- .setPriority(LocationRequest.PRIORITY_LOW_POWER); +- mPlayServicesLocationClient.requestLocationUpdates(request, +- PendingIntent.getService(WeatherExtension.this, 0, +- new Intent(WeatherExtension.this, WeatherExtension.class) +- .setAction(ACTION_RECEIVED_LOCATION), +- PendingIntent.FLAG_UPDATE_CURRENT)); +- +- // Schedule a retry if timing out. When the location request expires, updates +- // will simply stop, and we won't get any notification of this, so handle it +- // separately. +- mTimeoutHandler.removeCallbacksAndMessages(null); +- mTimeoutHandler.postDelayed(new Runnable() { +- @Override +- public void run() { +- LOGE(TAG, "Play Services location request timed out."); +- disableOneTimeLocationListener(); +- scheduleRetry(); +- } +- }, LOCATION_TIMEOUT_MILLIS); +- } else { +- tryPublishWeatherUpdateFromGeolocation(lastLocation); +- } +- +- mPlayServicesLocationClient.disconnect(); +- mPlayServicesLocationClient = null; +- } +- +- @Override +- public void onDisconnected() { +- mPlayServicesLocationClient = null; +- } +- }, new OnConnectionFailedListener() { +- @Override +- public void onConnectionFailed(ConnectionResult connectionResult) { +- mPlayServicesLocationClient = null; +- if (errorRunnable != null) { +- errorRunnable.run(); +- } +- } +- }); +- mPlayServicesLocationClient.connect(); ++ return; + } + + private void tryLocationManagerGetLocationAndPublishWeatherUpdate() { +@@ -365,21 +269,9 @@ public class WeatherExtension extends DashClockExtension { + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + if (intent != null && ACTION_RECEIVED_LOCATION.equals(intent.getAction())) { +- final Location location = intent.getParcelableExtra( +- LocationClient.KEY_LOCATION_CHANGED); + if (mServiceThreadHandler == null) { + LOGW(TAG, "Can't process location update because onUpdateData hasn't been called " + + "on this service instance."); +- } else if (location != null) { +- // A location update request succeeded; try publishing weather from here. +- LOGD(TAG, "Got a Play Services location update; trying weather update."); +- mTimeoutHandler.removeCallbacksAndMessages(null); +- mServiceThreadHandler.post(new Runnable() { +- @Override +- public void run() { +- tryPublishWeatherUpdateFromGeolocation(location); +- } +- }); + } + + stopSelf(startId); +@@ -391,9 +283,6 @@ public class WeatherExtension extends DashClockExtension { + @Override + public void onDestroy() { + super.onDestroy(); +- if (mPlayServicesLocationClient != null) { +- mPlayServicesLocationClient.disconnect(); +- } + disableOneTimeLocationListener(); + } +