lineage-sdk: Remove weather related code
* This has been untouched since 2016 and it depends on LockClock which has been dropped and was also untouched for years. There is no good weather provider without API restrictions, so just remove this dead code. Change-Id: I6540006ce0d7339b7794b6ab207593afb161aa3d
This commit is contained in:
@@ -27,7 +27,7 @@ include $(CLEAR_VARS)
|
||||
lineage_platform_res := APPS/org.lineageos.platform-res_intermediates/aapt
|
||||
|
||||
# List of packages used in lineage-api-stubs
|
||||
lineage_stub_packages := lineageos.app:lineageos.content:lineageos.hardware:lineageos.media:lineageos.os:lineageos.preference:lineageos.profiles:lineageos.providers:lineageos.platform:lineageos.power:lineageos.util:lineageos.weather:lineageos.weatherservice:lineageos.style:lineageos.trust
|
||||
lineage_stub_packages := lineageos.app:lineageos.content:lineageos.hardware:lineageos.media:lineageos.os:lineageos.preference:lineageos.profiles:lineageos.providers:lineageos.platform:lineageos.power:lineageos.util:lineageos.style:lineageos.trust
|
||||
|
||||
lineage_framework_module := $(LOCAL_INSTALLED_MODULE)
|
||||
|
||||
|
||||
@@ -339,8 +339,6 @@ package lineageos.platform {
|
||||
|
||||
public static final class Manifest.permission {
|
||||
ctor public Manifest.permission();
|
||||
field public static final java.lang.String ACCESS_WEATHER_MANAGER = "lineageos.permission.ACCESS_WEATHER_MANAGER";
|
||||
field public static final java.lang.String BIND_WEATHER_PROVIDER_SERVICE = "lineageos.permission.BIND_WEATHER_PROVIDER_SERVICE";
|
||||
field public static final java.lang.String HARDWARE_ABSTRACTION_ACCESS = "lineageos.permission.HARDWARE_ABSTRACTION_ACCESS";
|
||||
field public static final java.lang.String MANAGE_LIVEDISPLAY = "lineageos.permission.MANAGE_LIVEDISPLAY";
|
||||
field public static final java.lang.String MANAGE_REMOTE_PREFERENCES = "lineageos.permission.MANAGE_REMOTE_PREFERENCES";
|
||||
@@ -348,12 +346,10 @@ package lineageos.platform {
|
||||
field public static final java.lang.String PERFORMANCE_ACCESS = "lineageos.permission.PERFORMANCE_ACCESS";
|
||||
field public static final java.lang.String PROTECTED_APP = "lineageos.permission.PROTECTED_APP";
|
||||
field public static final java.lang.String READ_DATAUSAGE = "lineageos.permission.READ_DATAUSAGE";
|
||||
field public static final java.lang.String READ_WEATHER = "lineageos.permission.READ_WEATHER";
|
||||
field public static final java.lang.String TRUST_INTERFACE = "lineageos.permission.TRUST_INTERFACE";
|
||||
field public static final java.lang.String WRITE_DATAUSAGE = "lineageos.permission.WRITE_DATAUSAGE";
|
||||
field public static final java.lang.String WRITE_SECURE_SETTINGS = "lineageos.permission.WRITE_SECURE_SETTINGS";
|
||||
field public static final java.lang.String WRITE_SETTINGS = "lineageos.permission.WRITE_SETTINGS";
|
||||
field public static final java.lang.String WRITE_WEATHER = "lineageos.permission.WRITE_WEATHER";
|
||||
}
|
||||
|
||||
public final class R {
|
||||
@@ -739,7 +735,6 @@ package lineageos.providers {
|
||||
method public static boolean putString(android.content.ContentResolver, java.lang.String, java.lang.String);
|
||||
field public static final android.net.Uri CONTENT_URI;
|
||||
field public static final java.lang.String SYS_PROP_LINEAGE_SETTING_VERSION = "sys.lineage_settings_global_version";
|
||||
field public static final java.lang.String WEATHER_TEMPERATURE_UNIT = "weather_temperature_unit";
|
||||
}
|
||||
|
||||
public static class LineageSettings.LineageSettingNotFoundException extends android.util.AndroidException {
|
||||
@@ -860,7 +855,6 @@ package lineageos.providers {
|
||||
field public static final java.lang.String STATUS_BAR_NOTIF_COUNT = "status_bar_notif_count";
|
||||
field public static final java.lang.String STATUS_BAR_QUICK_QS_PULLDOWN = "qs_quick_pulldown";
|
||||
field public static final java.lang.String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
|
||||
field public static final java.lang.String STATUS_BAR_SHOW_WEATHER = "status_bar_show_weather";
|
||||
field public static final java.lang.String STYLUS_ICON_ENABLED = "stylus_icon_enabled";
|
||||
field public static final java.lang.String SWAP_VOLUME_KEYS_ON_ROTATION = "swap_volume_keys_on_rotation";
|
||||
field public static final java.lang.String SYSTEM_PROFILES_ENABLED = "system_profiles_enabled";
|
||||
@@ -878,95 +872,6 @@ package lineageos.providers {
|
||||
field public static final java.lang.String ZEN_PRIORITY_ALLOW_LIGHTS = "zen_priority_allow_lights";
|
||||
}
|
||||
|
||||
public class WeatherContract {
|
||||
ctor public WeatherContract();
|
||||
field public static final java.lang.String AUTHORITY = "org.lineageos.weather";
|
||||
field public static final android.net.Uri AUTHORITY_URI;
|
||||
}
|
||||
|
||||
public static class WeatherContract.WeatherColumns {
|
||||
ctor public WeatherContract.WeatherColumns();
|
||||
field public static final android.net.Uri CONTENT_URI;
|
||||
field public static final android.net.Uri CURRENT_AND_FORECAST_WEATHER_URI;
|
||||
field public static final java.lang.String CURRENT_CITY = "city";
|
||||
field public static final java.lang.String CURRENT_CONDITION = "condition";
|
||||
field public static final java.lang.String CURRENT_CONDITION_CODE = "condition_code";
|
||||
field public static final java.lang.String CURRENT_HUMIDITY = "humidity";
|
||||
field public static final java.lang.String CURRENT_TEMPERATURE = "temperature";
|
||||
field public static final java.lang.String CURRENT_TEMPERATURE_UNIT = "temperature_unit";
|
||||
field public static final java.lang.String CURRENT_TIMESTAMP = "timestamp";
|
||||
field public static final android.net.Uri CURRENT_WEATHER_URI;
|
||||
field public static final java.lang.String CURRENT_WIND_DIRECTION = "wind_direction";
|
||||
field public static final java.lang.String CURRENT_WIND_SPEED = "wind_speed";
|
||||
field public static final java.lang.String CURRENT_WIND_SPEED_UNIT = "wind_speed_unit";
|
||||
field public static final java.lang.String FORECAST_CONDITION = "forecast_condition";
|
||||
field public static final java.lang.String FORECAST_CONDITION_CODE = "forecast_condition_code";
|
||||
field public static final java.lang.String FORECAST_HIGH = "forecast_high";
|
||||
field public static final java.lang.String FORECAST_LOW = "forecast_low";
|
||||
field public static final android.net.Uri FORECAST_WEATHER_URI;
|
||||
field public static final java.lang.String TODAYS_HIGH_TEMPERATURE = "todays_high";
|
||||
field public static final java.lang.String TODAYS_LOW_TEMPERATURE = "todays_low";
|
||||
}
|
||||
|
||||
public static final class WeatherContract.WeatherColumns.TempUnit {
|
||||
field public static final int CELSIUS = 1; // 0x1
|
||||
field public static final int FAHRENHEIT = 2; // 0x2
|
||||
}
|
||||
|
||||
public static final class WeatherContract.WeatherColumns.WeatherCode {
|
||||
field public static final int BLOWING_SNOW = 14; // 0xe
|
||||
field public static final int BLUSTERY = 22; // 0x16
|
||||
field public static final int CLEAR_NIGHT = 30; // 0x1e
|
||||
field public static final int CLOUDY = 25; // 0x19
|
||||
field public static final int COLD = 24; // 0x18
|
||||
field public static final int DRIZZLE = 9; // 0x9
|
||||
field public static final int DUST = 18; // 0x12
|
||||
field public static final int FAIR_DAY = 33; // 0x21
|
||||
field public static final int FAIR_NIGHT = 32; // 0x20
|
||||
field public static final int FOGGY = 19; // 0x13
|
||||
field public static final int FREEZING_DRIZZLE = 8; // 0x8
|
||||
field public static final int FREEZING_RAIN = 10; // 0xa
|
||||
field public static final int HAIL = 16; // 0x10
|
||||
field public static final int HAZE = 20; // 0x14
|
||||
field public static final int HEAVY_SNOW = 39; // 0x27
|
||||
field public static final int HOT = 35; // 0x23
|
||||
field public static final int HURRICANE = 2; // 0x2
|
||||
field public static final int ISOLATED_THUNDERSHOWERS = 44; // 0x2c
|
||||
field public static final int ISOLATED_THUNDERSTORMS = 36; // 0x24
|
||||
field public static final int LIGHT_SNOW_SHOWERS = 13; // 0xd
|
||||
field public static final int MIXED_RAIN_AND_HAIL = 34; // 0x22
|
||||
field public static final int MIXED_RAIN_AND_SLEET = 6; // 0x6
|
||||
field public static final int MIXED_RAIN_AND_SNOW = 5; // 0x5
|
||||
field public static final int MIXED_SNOW_AND_SLEET = 7; // 0x7
|
||||
field public static final int MOSTLY_CLOUDY_DAY = 27; // 0x1b
|
||||
field public static final int MOSTLY_CLOUDY_NIGHT = 26; // 0x1a
|
||||
field public static final int NOT_AVAILABLE = 3200; // 0xc80
|
||||
field public static final int PARTLY_CLOUDY = 41; // 0x29
|
||||
field public static final int PARTLY_CLOUDY_DAY = 29; // 0x1d
|
||||
field public static final int PARTLY_CLOUDY_NIGHT = 28; // 0x1c
|
||||
field public static final int SCATTERED_SHOWERS = 38; // 0x26
|
||||
field public static final int SCATTERED_SNOW_SHOWERS = 40; // 0x28
|
||||
field public static final int SCATTERED_THUNDERSTORMS = 37; // 0x25
|
||||
field public static final int SEVERE_THUNDERSTORMS = 3; // 0x3
|
||||
field public static final int SHOWERS = 11; // 0xb
|
||||
field public static final int SLEET = 17; // 0x11
|
||||
field public static final int SMOKY = 21; // 0x15
|
||||
field public static final int SNOW = 15; // 0xf
|
||||
field public static final int SNOW_FLURRIES = 12; // 0xc
|
||||
field public static final int SNOW_SHOWERS = 43; // 0x2b
|
||||
field public static final int SUNNY = 31; // 0x1f
|
||||
field public static final int THUNDERSHOWER = 42; // 0x2a
|
||||
field public static final int THUNDERSTORMS = 4; // 0x4
|
||||
field public static final int TORNADO = 0; // 0x0
|
||||
field public static final int TROPICAL_STORM = 1; // 0x1
|
||||
field public static final int WINDY = 23; // 0x17
|
||||
}
|
||||
|
||||
public static final class WeatherContract.WeatherColumns.WindSpeedUnit {
|
||||
field public static final int KPH = 1; // 0x1
|
||||
field public static final int MPH = 2; // 0x2
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package lineageos.trust {
|
||||
@@ -1007,159 +912,3 @@ package lineageos.util {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package lineageos.weather {
|
||||
|
||||
public class LineageWeatherManager {
|
||||
method public void cancelRequest(int);
|
||||
method public java.lang.String getActiveWeatherServiceProviderLabel();
|
||||
method public static lineageos.weather.LineageWeatherManager getInstance(android.content.Context);
|
||||
method public int lookupCity(java.lang.String, lineageos.weather.LineageWeatherManager.LookupCityRequestListener);
|
||||
method public void registerWeatherServiceProviderChangeListener(lineageos.weather.LineageWeatherManager.WeatherServiceProviderChangeListener);
|
||||
method public int requestWeatherUpdate(android.location.Location, lineageos.weather.LineageWeatherManager.WeatherUpdateRequestListener);
|
||||
method public int requestWeatherUpdate(lineageos.weather.WeatherLocation, lineageos.weather.LineageWeatherManager.WeatherUpdateRequestListener);
|
||||
method public void unregisterWeatherServiceProviderChangeListener(lineageos.weather.LineageWeatherManager.WeatherServiceProviderChangeListener);
|
||||
}
|
||||
|
||||
public static abstract interface LineageWeatherManager.LookupCityRequestListener {
|
||||
method public abstract void onLookupCityRequestCompleted(int, java.util.List<lineageos.weather.WeatherLocation>);
|
||||
}
|
||||
|
||||
public static final class LineageWeatherManager.RequestStatus {
|
||||
field public static final int ALREADY_IN_PROGRESS = -3; // 0xfffffffd
|
||||
field public static final int COMPLETED = 1; // 0x1
|
||||
field public static final int FAILED = -1; // 0xffffffff
|
||||
field public static final int NO_MATCH_FOUND = -4; // 0xfffffffc
|
||||
field public static final int SUBMITTED_TOO_SOON = -2; // 0xfffffffe
|
||||
}
|
||||
|
||||
public static abstract interface LineageWeatherManager.WeatherServiceProviderChangeListener {
|
||||
method public abstract void onWeatherServiceProviderChanged(java.lang.String);
|
||||
}
|
||||
|
||||
public static abstract interface LineageWeatherManager.WeatherUpdateRequestListener {
|
||||
method public abstract void onWeatherRequestCompleted(int, lineageos.weather.WeatherInfo);
|
||||
}
|
||||
|
||||
public final class RequestInfo implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public java.lang.String getCityName();
|
||||
method public android.location.Location getLocation();
|
||||
method public int getRequestType();
|
||||
method public int getTemperatureUnit();
|
||||
method public lineageos.weather.WeatherLocation getWeatherLocation();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<lineageos.weather.RequestInfo> CREATOR;
|
||||
field public static final int TYPE_LOOKUP_CITY_NAME_REQ = 3; // 0x3
|
||||
field public static final int TYPE_WEATHER_BY_GEO_LOCATION_REQ = 1; // 0x1
|
||||
field public static final int TYPE_WEATHER_BY_WEATHER_LOCATION_REQ = 2; // 0x2
|
||||
}
|
||||
|
||||
public final class WeatherInfo implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public java.lang.String getCity();
|
||||
method public int getConditionCode();
|
||||
method public java.util.List<lineageos.weather.WeatherInfo.DayForecast> getForecasts();
|
||||
method public double getHumidity();
|
||||
method public double getTemperature();
|
||||
method public int getTemperatureUnit();
|
||||
method public long getTimestamp();
|
||||
method public double getTodaysHigh();
|
||||
method public double getTodaysLow();
|
||||
method public double getWindDirection();
|
||||
method public double getWindSpeed();
|
||||
method public int getWindSpeedUnit();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<lineageos.weather.WeatherInfo> CREATOR;
|
||||
}
|
||||
|
||||
public static class WeatherInfo.Builder {
|
||||
ctor public WeatherInfo.Builder(java.lang.String, double, int);
|
||||
method public lineageos.weather.WeatherInfo build();
|
||||
method public lineageos.weather.WeatherInfo.Builder setForecast(java.util.List<lineageos.weather.WeatherInfo.DayForecast>);
|
||||
method public lineageos.weather.WeatherInfo.Builder setHumidity(double);
|
||||
method public lineageos.weather.WeatherInfo.Builder setTimestamp(long);
|
||||
method public lineageos.weather.WeatherInfo.Builder setTodaysHigh(double);
|
||||
method public lineageos.weather.WeatherInfo.Builder setTodaysLow(double);
|
||||
method public lineageos.weather.WeatherInfo.Builder setWeatherCondition(int);
|
||||
method public lineageos.weather.WeatherInfo.Builder setWind(double, double, int);
|
||||
}
|
||||
|
||||
public static class WeatherInfo.DayForecast implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public int getConditionCode();
|
||||
method public double getHigh();
|
||||
method public double getLow();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<lineageos.weather.WeatherInfo.DayForecast> CREATOR;
|
||||
}
|
||||
|
||||
public static class WeatherInfo.DayForecast.Builder {
|
||||
ctor public WeatherInfo.DayForecast.Builder(int);
|
||||
method public lineageos.weather.WeatherInfo.DayForecast build();
|
||||
method public lineageos.weather.WeatherInfo.DayForecast.Builder setHigh(double);
|
||||
method public lineageos.weather.WeatherInfo.DayForecast.Builder setLow(double);
|
||||
}
|
||||
|
||||
public final class WeatherLocation implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public java.lang.String getCity();
|
||||
method public java.lang.String getCityId();
|
||||
method public java.lang.String getCountry();
|
||||
method public java.lang.String getCountryId();
|
||||
method public java.lang.String getPostalCode();
|
||||
method public java.lang.String getState();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<lineageos.weather.WeatherLocation> CREATOR;
|
||||
}
|
||||
|
||||
public static class WeatherLocation.Builder {
|
||||
ctor public WeatherLocation.Builder(java.lang.String, java.lang.String);
|
||||
ctor public WeatherLocation.Builder(java.lang.String);
|
||||
method public lineageos.weather.WeatherLocation build();
|
||||
method public lineageos.weather.WeatherLocation.Builder setCountry(java.lang.String);
|
||||
method public lineageos.weather.WeatherLocation.Builder setCountryId(java.lang.String);
|
||||
method public lineageos.weather.WeatherLocation.Builder setPostalCode(java.lang.String);
|
||||
method public lineageos.weather.WeatherLocation.Builder setState(java.lang.String);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package lineageos.weatherservice {
|
||||
|
||||
public final class ServiceRequest {
|
||||
method public void complete(lineageos.weatherservice.ServiceRequestResult);
|
||||
method public void fail();
|
||||
method public lineageos.weather.RequestInfo getRequestInfo();
|
||||
method public void reject(int);
|
||||
}
|
||||
|
||||
public final class ServiceRequestResult implements android.os.Parcelable {
|
||||
method public int describeContents();
|
||||
method public java.util.List<lineageos.weather.WeatherLocation> getLocationLookupList();
|
||||
method public lineageos.weather.WeatherInfo getWeatherInfo();
|
||||
method public void writeToParcel(android.os.Parcel, int);
|
||||
field public static final android.os.Parcelable.Creator<lineageos.weatherservice.ServiceRequestResult> CREATOR;
|
||||
}
|
||||
|
||||
public static class ServiceRequestResult.Builder {
|
||||
ctor public ServiceRequestResult.Builder();
|
||||
ctor public ServiceRequestResult.Builder(lineageos.weather.WeatherInfo);
|
||||
ctor public ServiceRequestResult.Builder(java.util.List<lineageos.weather.WeatherLocation>);
|
||||
method public lineageos.weatherservice.ServiceRequestResult build();
|
||||
}
|
||||
|
||||
public abstract class WeatherProviderService extends android.app.Service {
|
||||
ctor public WeatherProviderService();
|
||||
method protected final void attachBaseContext(android.content.Context);
|
||||
method public final android.os.IBinder onBind(android.content.Intent);
|
||||
method protected void onConnected();
|
||||
method protected void onDisconnected();
|
||||
method protected abstract void onRequestCancelled(lineageos.weatherservice.ServiceRequest);
|
||||
method protected abstract void onRequestSubmitted(lineageos.weatherservice.ServiceRequest);
|
||||
field public static final java.lang.String SERVICE_INTERFACE = "lineageos.weatherservice.WeatherProviderService";
|
||||
field public static final java.lang.String SERVICE_META_DATA = "lineageos.weatherservice";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -373,12 +373,6 @@ public final class LineageSettings {
|
||||
*/
|
||||
public static final String DOUBLE_TAP_SLEEP_GESTURE = "double_tap_sleep_gesture";
|
||||
|
||||
/**
|
||||
* Boolean value on whether to show weather in the statusbar
|
||||
* @hide
|
||||
*/
|
||||
public static final String STATUS_BAR_SHOW_WEATHER = "status_bar_show_weather";
|
||||
|
||||
/**
|
||||
* Show search bar in recents
|
||||
* @hide
|
||||
@@ -605,7 +599,6 @@ public final class LineageSettings {
|
||||
LineageSettings.System.DISPLAY_COLOR_ADJUSTMENT,
|
||||
LineageSettings.System.LIVE_DISPLAY_HINTED,
|
||||
LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE,
|
||||
LineageSettings.System.STATUS_BAR_SHOW_WEATHER,
|
||||
LineageSettings.System.RECENTS_SHOW_SEARCH_BAR,
|
||||
LineageSettings.System.NAVBAR_LEFT_IN_LANDSCAPE,
|
||||
LineageSettings.System.T9_SEARCH_INPUT_LOCALE,
|
||||
|
||||
@@ -1,518 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.platform.internal;
|
||||
|
||||
import android.app.AppGlobals;
|
||||
import android.annotation.NonNull;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteCallbackList;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Slog;
|
||||
import com.android.internal.content.PackageMonitor;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import lineageos.app.LineageContextConstants;
|
||||
import lineageos.platform.Manifest;
|
||||
import lineageos.providers.LineageSettings;
|
||||
import lineageos.providers.WeatherContract.WeatherColumns;
|
||||
import lineageos.weather.LineageWeatherManager;
|
||||
import lineageos.weather.ILineageWeatherManager;
|
||||
import lineageos.weather.IRequestInfoListener;
|
||||
import lineageos.weather.IWeatherServiceProviderChangeListener;
|
||||
import lineageos.weather.RequestInfo;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
import lineageos.weatherservice.IWeatherProviderService;
|
||||
import lineageos.weatherservice.IWeatherProviderServiceClient;
|
||||
import lineageos.weatherservice.ServiceRequestResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LineageWeatherManagerService extends LineageSystemService {
|
||||
|
||||
private static final String TAG = LineageWeatherManagerService.class.getSimpleName();
|
||||
|
||||
private IWeatherProviderService mWeatherProviderService;
|
||||
private boolean mIsWeatherProviderServiceBound;
|
||||
private Object mMutex = new Object();
|
||||
private Context mContext;
|
||||
private final RemoteCallbackList<IWeatherServiceProviderChangeListener> mProviderChangeListeners
|
||||
= new RemoteCallbackList<>();
|
||||
private volatile boolean mReconnectedDuePkgModified = false;
|
||||
|
||||
private final IWeatherProviderServiceClient mServiceClient
|
||||
= new IWeatherProviderServiceClient.Stub() {
|
||||
@Override
|
||||
public void setServiceRequestState(RequestInfo requestInfo,
|
||||
ServiceRequestResult result, int status) {
|
||||
synchronized (mMutex) {
|
||||
|
||||
if (requestInfo == null) {
|
||||
//Invalid request info object
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValidRequestInfoStatus(status)) {
|
||||
//Invalid request status
|
||||
return;
|
||||
}
|
||||
|
||||
final IRequestInfoListener listener = requestInfo.getRequestListener();
|
||||
final int requestType = requestInfo.getRequestType();
|
||||
|
||||
switch (requestType) {
|
||||
case RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
WeatherInfo weatherInfo = null;
|
||||
if (status == LineageWeatherManager.RequestStatus.COMPLETED) {
|
||||
weatherInfo = (result != null) ? result.getWeatherInfo() : null;
|
||||
if (weatherInfo == null) {
|
||||
//This should never happen! WEATHER_REQUEST_COMPLETED is set
|
||||
//only if the weatherinfo object was not null when the request
|
||||
//was marked as completed
|
||||
status = LineageWeatherManager.RequestStatus.FAILED;
|
||||
} else {
|
||||
if (!requestInfo.isQueryOnlyWeatherRequest()) {
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
updateWeatherInfoLocked(weatherInfo);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isValidListener(listener)) {
|
||||
try {
|
||||
listener.onWeatherRequestCompleted(requestInfo, status,
|
||||
weatherInfo);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
if (isValidListener(listener)) {
|
||||
try {
|
||||
//Result might be null if the provider marked the request as failed
|
||||
listener.onLookupCityRequestCompleted(requestInfo, status,
|
||||
result != null ? result.getLocationLookupList() : null);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private boolean isValidRequestInfoStatus(int state) {
|
||||
switch (state) {
|
||||
case LineageWeatherManager.RequestStatus.COMPLETED:
|
||||
case LineageWeatherManager.RequestStatus.ALREADY_IN_PROGRESS:
|
||||
case LineageWeatherManager.RequestStatus.FAILED:
|
||||
case LineageWeatherManager.RequestStatus.NO_MATCH_FOUND:
|
||||
case LineageWeatherManager.RequestStatus.SUBMITTED_TOO_SOON:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidListener(IRequestInfoListener listener) {
|
||||
return (listener != null && listener.asBinder().pingBinder());
|
||||
}
|
||||
|
||||
private void enforcePermission() {
|
||||
mContext.enforceCallingOrSelfPermission(
|
||||
Manifest.permission.ACCESS_WEATHER_MANAGER, null);
|
||||
}
|
||||
|
||||
private final IBinder mService = new ILineageWeatherManager.Stub() {
|
||||
|
||||
@Override
|
||||
public void updateWeather(RequestInfo info) {
|
||||
enforcePermission();
|
||||
processWeatherUpdateRequest(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lookupCity(RequestInfo info) {
|
||||
enforcePermission();
|
||||
processCityNameLookupRequest(info);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWeatherServiceProviderChangeListener(
|
||||
IWeatherServiceProviderChangeListener listener) {
|
||||
enforcePermission();
|
||||
mProviderChangeListeners.register(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterWeatherServiceProviderChangeListener(
|
||||
IWeatherServiceProviderChangeListener listener) {
|
||||
enforcePermission();
|
||||
mProviderChangeListeners.unregister(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveWeatherServiceProviderLabel() {
|
||||
enforcePermission();
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
String enabledProviderService = LineageSettings.Secure.getString(
|
||||
mContext.getContentResolver(), LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
if (enabledProviderService != null) {
|
||||
return getComponentLabel(
|
||||
ComponentName.unflattenFromString(enabledProviderService));
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelRequest(int requestId) {
|
||||
enforcePermission();
|
||||
processCancelRequest(requestId);
|
||||
}
|
||||
};
|
||||
|
||||
private String getComponentLabel(ComponentName componentName) {
|
||||
final PackageManager pm = mContext.getPackageManager();
|
||||
Intent intent = new Intent().setComponent(componentName);
|
||||
ResolveInfo resolveInfo = pm.resolveService(intent,
|
||||
PackageManager.GET_SERVICES);
|
||||
if (resolveInfo != null) {
|
||||
return resolveInfo.loadLabel(pm).toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public LineageWeatherManagerService(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFeatureDeclaration() {
|
||||
return LineageContextConstants.Features.WEATHER_SERVICES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
publishBinderService(LineageContextConstants.LINEAGE_WEATHER_SERVICE, mService);
|
||||
registerPackageMonitor();
|
||||
registerSettingsObserver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBootPhase(int phase) {
|
||||
// Do nothing. We need userland apps to be fully up and running.
|
||||
// We will connect in onUnlockUser instead.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserUnlocking(@NonNull TargetUser user) {
|
||||
bindActiveWeatherProviderService();
|
||||
}
|
||||
|
||||
private void bindActiveWeatherProviderService() {
|
||||
String activeProviderService = LineageSettings.Secure.getString(mContext.getContentResolver(),
|
||||
LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
if (activeProviderService != null) {
|
||||
if (!getContext().bindServiceAsUser(new Intent().setComponent(
|
||||
ComponentName.unflattenFromString(activeProviderService)),
|
||||
mWeatherServiceProviderConnection, Context.BIND_AUTO_CREATE,
|
||||
UserHandle.CURRENT)) {
|
||||
Slog.w(TAG, "Failed to bind service " + activeProviderService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canProcessWeatherUpdateRequest(RequestInfo info) {
|
||||
final IRequestInfoListener listener = info.getRequestListener();
|
||||
|
||||
if (!mIsWeatherProviderServiceBound) {
|
||||
if (listener != null && listener.asBinder().pingBinder()) {
|
||||
try {
|
||||
listener.onWeatherRequestCompleted(info,
|
||||
LineageWeatherManager.RequestStatus.FAILED, null);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized void processWeatherUpdateRequest(RequestInfo info) {
|
||||
if (!canProcessWeatherUpdateRequest(info)) return;
|
||||
try {
|
||||
mWeatherProviderService.processWeatherUpdateRequest(info);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
|
||||
private void processCityNameLookupRequest(RequestInfo info) {
|
||||
if (!mIsWeatherProviderServiceBound) {
|
||||
final IRequestInfoListener listener = info.getRequestListener();
|
||||
if (listener != null && listener.asBinder().pingBinder()) {
|
||||
try {
|
||||
listener.onLookupCityRequestCompleted(info,
|
||||
LineageWeatherManager.RequestStatus.FAILED, null);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mWeatherProviderService.processCityNameLookupRequest(info);
|
||||
} catch(RemoteException e){
|
||||
}
|
||||
}
|
||||
|
||||
private void processCancelRequest(int requestId) {
|
||||
if (mIsWeatherProviderServiceBound) {
|
||||
try {
|
||||
mWeatherProviderService.cancelRequest(requestId);
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceConnection mWeatherServiceProviderConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
mWeatherProviderService = IWeatherProviderService.Stub.asInterface(service);
|
||||
mIsWeatherProviderServiceBound = true;
|
||||
try {
|
||||
mWeatherProviderService.setServiceClient(mServiceClient);
|
||||
} catch(RemoteException e) {
|
||||
}
|
||||
if (!mReconnectedDuePkgModified) {
|
||||
notifyProviderChanged(name);
|
||||
}
|
||||
mReconnectedDuePkgModified = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
mWeatherProviderService = null;
|
||||
mIsWeatherProviderServiceBound = false;
|
||||
Slog.d(TAG, "Connection with " + name.flattenToString() + " has been closed");
|
||||
}
|
||||
};
|
||||
|
||||
private void notifyProviderChanged(ComponentName name) {
|
||||
String providerName = null;
|
||||
if (name != null) {
|
||||
providerName = getComponentLabel(name);
|
||||
}
|
||||
|
||||
int N = mProviderChangeListeners.beginBroadcast();
|
||||
for (int indx = 0; indx < N; indx++) {
|
||||
IWeatherServiceProviderChangeListener listener
|
||||
= mProviderChangeListeners.getBroadcastItem(indx);
|
||||
try {
|
||||
listener.onWeatherServiceProviderChanged(providerName);
|
||||
} catch (RemoteException e){
|
||||
}
|
||||
}
|
||||
mProviderChangeListeners.finishBroadcast();
|
||||
}
|
||||
|
||||
private boolean updateWeatherInfoLocked(WeatherInfo wi) {
|
||||
final int size = wi.getForecasts().size() + 1;
|
||||
List<ContentValues> contentValuesList = new ArrayList<>(size);
|
||||
ContentValues contentValues = new ContentValues();
|
||||
|
||||
contentValues.put(WeatherColumns.CURRENT_CITY, wi.getCity());
|
||||
contentValues.put(WeatherColumns.CURRENT_TEMPERATURE, wi.getTemperature());
|
||||
contentValues.put(WeatherColumns.CURRENT_TEMPERATURE_UNIT, wi.getTemperatureUnit());
|
||||
contentValues.put(WeatherColumns.CURRENT_CONDITION_CODE, wi.getConditionCode());
|
||||
contentValues.put(WeatherColumns.CURRENT_HUMIDITY, wi.getHumidity());
|
||||
contentValues.put(WeatherColumns.CURRENT_WIND_SPEED, wi.getWindSpeed());
|
||||
contentValues.put(WeatherColumns.CURRENT_WIND_DIRECTION, wi.getWindDirection());
|
||||
contentValues.put(WeatherColumns.CURRENT_WIND_SPEED_UNIT, wi.getWindSpeedUnit());
|
||||
contentValues.put(WeatherColumns.CURRENT_TIMESTAMP, wi.getTimestamp());
|
||||
contentValues.put(WeatherColumns.TODAYS_HIGH_TEMPERATURE, wi.getTodaysHigh());
|
||||
contentValues.put(WeatherColumns.TODAYS_LOW_TEMPERATURE, wi.getTodaysLow());
|
||||
contentValuesList.add(contentValues);
|
||||
|
||||
for (WeatherInfo.DayForecast df : wi.getForecasts()) {
|
||||
contentValues = new ContentValues();
|
||||
contentValues.put(WeatherColumns.FORECAST_LOW, df.getLow());
|
||||
contentValues.put(WeatherColumns.FORECAST_HIGH, df.getHigh());
|
||||
contentValues.put(WeatherColumns.FORECAST_CONDITION_CODE, df.getConditionCode());
|
||||
contentValuesList.add(contentValues);
|
||||
}
|
||||
|
||||
if (size != getContext().getContentResolver().bulkInsert(
|
||||
WeatherColumns.CURRENT_AND_FORECAST_WEATHER_URI,
|
||||
contentValuesList.toArray(new ContentValues[0]))) {
|
||||
Slog.w(TAG, "Failed to update the weather content provider");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void registerPackageMonitor() {
|
||||
PackageMonitor monitor = new PackageMonitor() {
|
||||
@Override
|
||||
public void onPackageModified(String packageName) {
|
||||
String enabledProviderService = LineageSettings.Secure.getString(
|
||||
mContext.getContentResolver(), LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
if (enabledProviderService == null) return;
|
||||
ComponentName cn = ComponentName.unflattenFromString(enabledProviderService);
|
||||
if (!TextUtils.equals(packageName, cn.getPackageName())) return;
|
||||
|
||||
if (cn.getPackageName().equals(packageName) && !mIsWeatherProviderServiceBound) {
|
||||
//We were disconnected because the whole package changed
|
||||
//(most likely remove->install)
|
||||
if (!getContext().bindServiceAsUser(new Intent().setComponent(cn),
|
||||
mWeatherServiceProviderConnection, Context.BIND_AUTO_CREATE,
|
||||
UserHandle.CURRENT)) {
|
||||
LineageSettings.Secure.putStringForUser( mContext.getContentResolver(),
|
||||
LineageSettings.Secure.WEATHER_PROVIDER_SERVICE, null,
|
||||
getChangingUserId());
|
||||
Slog.w(TAG, "Unable to rebind " + cn.flattenToString() + " after receiving"
|
||||
+ " package modified notification. Settings updated.");
|
||||
} else {
|
||||
mReconnectedDuePkgModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPackageChanged(String packageName, int uid, String[] components) {
|
||||
String enabledProviderService = LineageSettings.Secure.getString(
|
||||
mContext.getContentResolver(), LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
if (enabledProviderService == null) return false;
|
||||
|
||||
boolean packageChanged = false;
|
||||
ComponentName cn = ComponentName.unflattenFromString(enabledProviderService);
|
||||
for (String component : components) {
|
||||
if (cn.getPackageName().equals(component)) {
|
||||
packageChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (packageChanged) {
|
||||
try {
|
||||
final IPackageManager pm = AppGlobals.getPackageManager();
|
||||
final int enabled = pm.getApplicationEnabledSetting(packageName,
|
||||
getChangingUserId());
|
||||
if (enabled == PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
|| enabled == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) {
|
||||
return false;
|
||||
} else {
|
||||
disconnectClient();
|
||||
//The package is not enabled so we can't use it anymore
|
||||
LineageSettings.Secure.putStringForUser(
|
||||
mContext.getContentResolver(),
|
||||
LineageSettings.Secure.WEATHER_PROVIDER_SERVICE, null,
|
||||
getChangingUserId());
|
||||
Slog.w(TAG, "Active provider " + cn.flattenToString() + " disabled");
|
||||
notifyProviderChanged(null);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
Slog.d(TAG, "Exception trying to look up app enabled settings ", e);
|
||||
} catch (RemoteException e) {
|
||||
// Really?
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageRemoved(String packageName, int uid) {
|
||||
String enabledProviderService = LineageSettings.Secure.getString(
|
||||
mContext.getContentResolver(), LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
if (enabledProviderService == null) return;
|
||||
|
||||
ComponentName cn = ComponentName.unflattenFromString(enabledProviderService);
|
||||
if (!TextUtils.equals(packageName, cn.getPackageName())) return;
|
||||
|
||||
disconnectClient();
|
||||
LineageSettings.Secure.putStringForUser(
|
||||
mContext.getContentResolver(), LineageSettings.Secure.WEATHER_PROVIDER_SERVICE,
|
||||
null, getChangingUserId());
|
||||
notifyProviderChanged(null);
|
||||
}
|
||||
};
|
||||
|
||||
monitor.register(mContext, BackgroundThread.getHandler().getLooper(), UserHandle.ALL, true);
|
||||
}
|
||||
|
||||
private void registerSettingsObserver() {
|
||||
final Uri enabledWeatherProviderServiceUri = LineageSettings.Secure.getUriFor(
|
||||
LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
ContentObserver observer = new ContentObserver(BackgroundThread.getHandler()) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange, Uri uri, int userId) {
|
||||
if (enabledWeatherProviderServiceUri.equals(uri)) {
|
||||
String activeSrvc = LineageSettings.Secure.getString(mContext.getContentResolver(),
|
||||
LineageSettings.Secure.WEATHER_PROVIDER_SERVICE);
|
||||
disconnectClient();
|
||||
if (activeSrvc != null) {
|
||||
ComponentName cn = ComponentName.unflattenFromString(activeSrvc);
|
||||
getContext().bindServiceAsUser(new Intent().setComponent(cn),
|
||||
mWeatherServiceProviderConnection, Context.BIND_AUTO_CREATE,
|
||||
UserHandle.CURRENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mContext.getContentResolver().registerContentObserver(enabledWeatherProviderServiceUri,
|
||||
false, observer, UserHandle.USER_ALL);
|
||||
}
|
||||
|
||||
private synchronized void disconnectClient() {
|
||||
if (mIsWeatherProviderServiceBound) {
|
||||
//let's cancel any pending request
|
||||
try {
|
||||
mWeatherProviderService.cancelOngoingRequests();
|
||||
} catch (RemoteException e) {
|
||||
Slog.d(TAG, "Error occurred while trying to cancel ongoing requests");
|
||||
}
|
||||
//Disconnect from client
|
||||
try {
|
||||
mWeatherProviderService.setServiceClient(null);
|
||||
} catch (RemoteException e) {
|
||||
Slog.d(TAG, "Error occurred while disconnecting client");
|
||||
}
|
||||
|
||||
getContext().unbindService(mWeatherServiceProviderConnection);
|
||||
mIsWeatherProviderServiceBound = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,25 +77,6 @@
|
||||
android:description="@string/permdesc_perfAccessDesc"
|
||||
android:protectionLevel="signature|privileged" />
|
||||
|
||||
<!-- Allows an application to read the weather content from the provider-->
|
||||
<permission android:name="lineageos.permission.READ_WEATHER"
|
||||
android:label="@string/permlab_weather_read"
|
||||
android:description="@string/permdesc_weather_read"
|
||||
android:protectionLevel="normal"/>
|
||||
|
||||
<!-- Allows an application to update the content of the weather provider
|
||||
<p>Not for use by third-party applications. -->
|
||||
<permission android:name="lineageos.permission.WRITE_WEATHER"
|
||||
android:label="@string/permlab_weather_write"
|
||||
android:description="@string/permdesc_weather_write"
|
||||
android:protectionLevel="signature|privileged" />
|
||||
|
||||
<!-- Allows an application to be identified as a weather provider service -->
|
||||
<permission android:name="lineageos.permission.BIND_WEATHER_PROVIDER_SERVICE"
|
||||
android:label="@string/permlab_weather_bind"
|
||||
android:description="@string/permdesc_weather_bind"
|
||||
android:protectionLevel="signature"/>
|
||||
|
||||
<!-- Allows an application to observe system-wide changes to audio sessions
|
||||
@hide -->
|
||||
<permission android:name="lineageos.permission.OBSERVE_AUDIO_SESSIONS"
|
||||
@@ -103,14 +84,6 @@
|
||||
android:description="@string/permdesc_observe_audio_sessions"
|
||||
android:protectionLevel="normal"/>
|
||||
|
||||
<!-- Allows an application to access the weather service.
|
||||
<p>Although the protection is normal, this permission should be required ONLY by those apps
|
||||
meant to do something meaningful with the data provided by the service (LockClock, SysUI)-->
|
||||
<permission android:name="lineageos.permission.ACCESS_WEATHER_MANAGER"
|
||||
android:label="@string/permlab_weather_access_mgr"
|
||||
android:description="@string/permdesc_weather_access_mgr"
|
||||
android:protectionLevel="normal"/>
|
||||
|
||||
<!-- Allows an application to manage LiveDisplay -->
|
||||
<permission android:name="lineageos.permission.MANAGE_LIVEDISPLAY"
|
||||
android:label="@string/permlab_manageLiveDisplay"
|
||||
|
||||
@@ -66,14 +66,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay verander na buitelug modus.</string>
|
||||
<string name="permlab_perfAccess">toegang na prestasie bestuurder</string>
|
||||
<string name="permdesc_perfAccessDesc">Laat \'n toep toe om toegang na die prestasie diens te verkry. Moet nooit nodig wees vir normale programme nie.</string>
|
||||
<string name="permlab_weather_read">lees weer</string>
|
||||
<string name="permdesc_weather_read">Laat \'n toep toe om inhoud te lees vanaf die weer verskaffer.</string>
|
||||
<string name="permlab_weather_write">opdateer weer verskaffer</string>
|
||||
<string name="permdesc_weather_write">Laat \'n toep toe om inhoud van die weer verskaffer by te werk.</string>
|
||||
<string name="permlab_weather_bind">bind as \'n weer verskaffer diens</string>
|
||||
<string name="permdesc_weather_bind">Laat \'n toep toe om as \'n weer diens verskaffer geïdentifiseer te word.</string>
|
||||
<string name="permlab_weather_access_mgr">toegang na weer diens</string>
|
||||
<string name="permdesc_weather_access_mgr">Laat \'n toep om toegang te verkry tot die weer diens in die stelsel. Moet nooit nodig wees vir die normale toepassings.</string>
|
||||
<string name="permlab_dataUsageWrite">modifiseer data gebruik databasis</string>
|
||||
<string name="permdesc_dataUsageWrite">Laat \'n toep toe om die inhoud opdateer van die data gebruik databasis.</string>
|
||||
<string name="permlab_dataUsageRead">lees data gebruik databasis</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">تم تغيير LiveDisplay إلى وضع الأماكن المفتوحة.</string>
|
||||
<string name="permlab_perfAccess">الوصول إلى مدير الأداء</string>
|
||||
<string name="permdesc_perfAccessDesc">السماح للتطبيق بالوصول إلى خدمة الأداء. ينبغي ألا يكون ضرورياً للتطبيقات العادية.</string>
|
||||
<string name="permlab_weather_read">قراءة الطقس</string>
|
||||
<string name="permdesc_weather_read">يسمح لتطبيق معين بقراءة المحتوى من موفر الطقس.</string>
|
||||
<string name="permlab_weather_write">تحديث موفر الطقس</string>
|
||||
<string name="permdesc_weather_write">يسمح لتطبيق معين بتحديث المحتوى من موفر الطقس.</string>
|
||||
<string name="permlab_weather_bind">ربط كخدمة موفر الطقس</string>
|
||||
<string name="permdesc_weather_bind">يسمح بتعريف تطبيق كخدمة موفر طقس.</string>
|
||||
<string name="permlab_weather_access_mgr">الوصول إلى خدمة الطقس</string>
|
||||
<string name="permdesc_weather_access_mgr">يسمح لتطبيق معين بالوصول إلى خدمة الطقس في النظام. لا يتعين الاحتياج إليه كليةً للتطبيقات العادية.</string>
|
||||
<string name="permlab_dataUsageWrite">تعديل قاعدة بيانات استخدام البيانات</string>
|
||||
<string name="permdesc_dataUsageWrite">يسمح لتطبيق معين بتحديث المحتوى من قاعدة بيانات استخدام البيانات.</string>
|
||||
<string name="permlab_dataUsageRead">قراءة قاعدة بيانات استخدام البيانات</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay camudó al mou esterior.</string>
|
||||
<string name="permlab_perfAccess">acceder al xestor de rindimientu</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite qu\'una aplicación acceda al serviciu de rindimientu. Enxamás debería precisase p\'aplicaciones normales.</string>
|
||||
<string name="permlab_weather_read">lleer la metereoloxía</string>
|
||||
<string name="permdesc_weather_read">Permite qu\'una aplicación llea\'l conteníu del fornidor meteorolóxicu.</string>
|
||||
<string name="permlab_weather_write">anovar el fornidor meteorolóxicu</string>
|
||||
<string name="permdesc_weather_write">Permite qu\'una aplicación anueve\'l conteníu del fornidor meteorolóxicu.</string>
|
||||
<string name="permlab_weather_bind">arreyar como serviciu fornidor de metereoloxía</string>
|
||||
<string name="permdesc_weather_bind">Permite qu\'una aplicación s\'identifique como un serviciu fornidor de meteoroloxía.</string>
|
||||
<string name="permlab_weather_access_mgr">acceder al serviciu de metereoloxía</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite qu\'una aplicación acceda al serviciu meteorolóxicu nel sistema. Enxamás debería precisase p\'aplicaciones normales.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar base de datos d\'usu de datos</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite qu\'una aplicación anueve\'l conteníu de la base de datos d\'usu de datos.</string>
|
||||
<string name="permlab_dataUsageRead">lleer base de datos d\'usu de datos</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay açıq hava rejiminə keçdi.</string>
|
||||
<string name="permlab_perfAccess">performans idarəçisinə müraciət</string>
|
||||
<string name="permdesc_perfAccessDesc">Tətbiqetmənin performans xidmətinə müraciətinə icazə verər. Normal tətbiqlər üçün lazım deyil.</string>
|
||||
<string name="permlab_weather_read">hava məlumatını oxu</string>
|
||||
<string name="permdesc_weather_read">Tətbiqetməyə hava təchizatçısından məzmunları oxumağa icazə verər.</string>
|
||||
<string name="permlab_weather_write">hava təchizatçısını yenilə</string>
|
||||
<string name="permdesc_weather_write">Tətbiqetməyə hava təchizatçısı məzmununu yeniləməyə icazə verər.</string>
|
||||
<string name="permlab_weather_bind">hava təchizatçı xidməti kimi qoş</string>
|
||||
<string name="permdesc_weather_bind">Tətbiqetmənin hava təchizatçısı xidməti kimi təqdim edilməsinə icazə verər.</string>
|
||||
<string name="permlab_weather_access_mgr">hava xidmətinə müraciət</string>
|
||||
<string name="permdesc_weather_access_mgr">Tətbiqetmənin sistemdəki hava xidmətinə müraciətinə icazə verər. Normal tətbiqlər üçün lazım deyil.</string>
|
||||
<string name="permlab_dataUsageWrite">verilənlər istifadəsi verilənlər bazasını dəyişdir</string>
|
||||
<string name="permdesc_dataUsageWrite">Tətbiqetməyə verilənlər istifadəsi verilənlər bazasının məzmununu yeniləməyə icazə verər.</string>
|
||||
<string name="permlab_dataUsageRead">verilənlər istifadəsi verilənlər bazasını oxu</string>
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_auto">LiveDisplay зменены на аўтаматычны рэжым.</string>
|
||||
<string name="permlab_perfAccess">доступ да менеджара прадукцыйнасці</string>
|
||||
<string name="permdesc_perfAccessDesc">Дадатак зможа атрымваць доступ да службы прадукцыйнасці. Гэты дазвол не выкарыстоўваецца звычайнымі дадаткамі.</string>
|
||||
<string name="permlab_weather_write">Абнавіць звесткі аб надвор’і</string>
|
||||
<string name="permlab_manageLiveDisplay">кіраванне наладамі LiveDisplay</string>
|
||||
<string name="permlab_manageRemotePrefs">кіраваньне аддаленнымі наладамі</string>
|
||||
<string name="permdesc_manageRemotePrefs">Дадатак зможа кіраваць аддаленымі наладамі</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">Адаптивен дисплей е променен на външен режим.</string>
|
||||
<string name="permlab_perfAccess">Достъп до диспечера за производителност</string>
|
||||
<string name="permdesc_perfAccessDesc">Осигурява на приложението достъп до диспечера за производителност. Не е необходимо за нормални приложения.</string>
|
||||
<string name="permlab_weather_read">прочети прогнозата</string>
|
||||
<string name="permdesc_weather_read">Разрешава на приложението да чете данни от доставчика на време.</string>
|
||||
<string name="permlab_weather_write">Актуализиране на доставчика на време</string>
|
||||
<string name="permdesc_weather_write">Разрешава на приложението да актуализира съдържанието на доставчика на време.</string>
|
||||
<string name="permlab_weather_bind">Задай като доставчик на време</string>
|
||||
<string name="permdesc_weather_bind">Позволява на приложение да бъде идентифицирано като доставчик на време.</string>
|
||||
<string name="permlab_weather_access_mgr">Достъп до метеорологична служба</string>
|
||||
<string name="permdesc_weather_access_mgr">Позволява на приложението достъп до услугата за време. Не е необходимо за нормални приложения.</string>
|
||||
<string name="permlab_dataUsageWrite">Промени база данни</string>
|
||||
<string name="permdesc_dataUsageWrite">Разрешава на приложението да актуализира съдържанието на базата данни.</string>
|
||||
<string name="permlab_dataUsageRead">Прочети база данни</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay canviat al mode exterior.</string>
|
||||
<string name="permlab_perfAccess">accés a l\'administrador de rendiment</string>
|
||||
<string name="permdesc_perfAccessDesc">Permet a una aplicació accedir al servei de rendiment. Normalment no hauria de ser necessari en les aplicacions normals.</string>
|
||||
<string name="permlab_weather_read">llegir el temps</string>
|
||||
<string name="permdesc_weather_read">Permet a una aplicació llegir els continguts del proveïdor meteorològic.</string>
|
||||
<string name="permlab_weather_write">actualitzar el proveïdor meteorològic</string>
|
||||
<string name="permdesc_weather_write">Permet a una aplicació actualitzar els continguts del proveïdor meteorològic.</string>
|
||||
<string name="permlab_weather_bind">vincula com a un servei de proveïdor meteorològic</string>
|
||||
<string name="permdesc_weather_bind">Permet a una aplicació ser identificada com un servei de proveïdor meteorològic.</string>
|
||||
<string name="permlab_weather_access_mgr">accés al servei del temps</string>
|
||||
<string name="permdesc_weather_access_mgr">Permet a una aplicació accedir al servei del temps del sistema. No s\'hauria de necessitar mai en les aplicacions normals.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar la base de dades d\'ús de dades</string>
|
||||
<string name="permdesc_dataUsageWrite">Permet a una aplicació actualitzar el contingut de la base de dades d\'ús de dades.</string>
|
||||
<string name="permlab_dataUsageRead">llegi la base de dades d\'ús de dades</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay změněn na režim venku.</string>
|
||||
<string name="permlab_perfAccess">přístup ke správci výkonu</string>
|
||||
<string name="permdesc_perfAccessDesc">Umožňuje přistupovat ke službě výkonu. Toto oprávnění by neměla vyžadovat žádná normální aplikace.</string>
|
||||
<string name="permlab_weather_read">číst počasí</string>
|
||||
<string name="permdesc_weather_read">Umožní číst obsah od poskytovatele počasí.</string>
|
||||
<string name="permlab_weather_write">aktualizovat poskytovatele počasí</string>
|
||||
<string name="permdesc_weather_write">Umožní aktualizovat obsah poskytovatele počasí.</string>
|
||||
<string name="permlab_weather_bind">vázat se jako služba poskytovatele počasí</string>
|
||||
<string name="permdesc_weather_bind">Umožní identifikaci jako služba poskytovatele počasí.</string>
|
||||
<string name="permlab_weather_access_mgr">přistupovat ke službě počasí</string>
|
||||
<string name="permdesc_weather_access_mgr">Umožní přistupovat ke službě počasí v systému. Toto oprávnění by neměla vyžadovat žádná normální aplikace.</string>
|
||||
<string name="permlab_dataUsageWrite">měnit databázi využití dat</string>
|
||||
<string name="permdesc_dataUsageWrite">Umožní aktualizovat obsah databáze využití dat.</string>
|
||||
<string name="permlab_dataUsageRead">čist databázi využití dat</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay wedi\'i newid i fodd awyr agored.</string>
|
||||
<string name="permlab_perfAccess">mynediad at reolwr perfformiad</string>
|
||||
<string name="permdesc_perfAccessDesc">Mae\'n caniatáu i ap gyrchu\'r gwasanaeth perfformiad. Ni ddylai apiau arferol byth fod ei angen.</string>
|
||||
<string name="permlab_weather_read">darllen y tywydd</string>
|
||||
<string name="permdesc_weather_read">Mae\'n caniatáu i ap ddarllen cynnwys gan y darparydd tywydd.</string>
|
||||
<string name="permlab_weather_write">diweddaru darparwr tywydd</string>
|
||||
<string name="permdesc_weather_write">Mae\'n caniatáu i ap ddiweddaru cynnwys y darparydd tywydd.</string>
|
||||
<string name="permlab_weather_bind">clymu fel gwasanaeth darparu tywydd</string>
|
||||
<string name="permdesc_weather_bind">Mae\'n galluogi ap i gael ei adnabod fel gwasanaeth darparu tywydd.</string>
|
||||
<string name="permlab_weather_access_mgr">mynediad at wasanaeth tywydd</string>
|
||||
<string name="permdesc_weather_access_mgr">Mae\'n caniatáu i ap gyrchu\'r gwasanaeth tywydd yn y system. Ni ddylai apiau arferol byth fod ei angen.</string>
|
||||
<string name="permlab_dataUsageWrite">addasu\'r gronfa ddata defnydd data</string>
|
||||
<string name="permdesc_dataUsageWrite">Mae\'n caniatáu i ap ddiweddaru cynnwys y gronfa ddata defnydd data.</string>
|
||||
<string name="permlab_dataUsageRead">darllen cronfa ddata defnydd data</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay ændret til udendørstilstand.</string>
|
||||
<string name="permlab_perfAccess">tilgå ydelseshåndtering</string>
|
||||
<string name="permdesc_perfAccessDesc">Tillader en app at tilgå ydelsestjenesten. Bør aldrig være nødvendigt for normale apps.</string>
|
||||
<string name="permlab_weather_read">læs vejret</string>
|
||||
<string name="permdesc_weather_read">Tillader en app at læse indholdet fra en vejr-udbyder.</string>
|
||||
<string name="permlab_weather_write">opdater vejr-udbyder</string>
|
||||
<string name="permdesc_weather_write">Tillader en app at opdatere indholdet fra en vejr-udbyder.</string>
|
||||
<string name="permlab_weather_bind">forbind som en vejrudbyder service</string>
|
||||
<string name="permdesc_weather_bind">Tillader at en app kan identificeres som en vejrudbyder service.</string>
|
||||
<string name="permlab_weather_access_mgr">tilgå vejr-tjenesten</string>
|
||||
<string name="permdesc_weather_access_mgr">Tillader en app at tilgå vejrtjenesten i systemet. Bør aldrig være nødvendig for alm. apps.</string>
|
||||
<string name="permlab_dataUsageWrite">ændre database for dataforbrug</string>
|
||||
<string name="permdesc_dataUsageWrite">Tillader en app at opdatere indholdet af databasen for dataforbrug.</string>
|
||||
<string name="permlab_dataUsageRead">læs database for dataforbrug</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay auf Außen-Modus geändert.</string>
|
||||
<string name="permlab_perfAccess">Zugriff auf Leistungsmanager</string>
|
||||
<string name="permdesc_perfAccessDesc">Ermöglicht der App, den Zugriff auf den Leistungsdienst. Wird für normale Apps nicht benötigt.</string>
|
||||
<string name="permlab_weather_read">Wetter auslesen</string>
|
||||
<string name="permdesc_weather_read">Ermöglicht der App, Inhalte des Wetterdatenanbieters auszulesen.</string>
|
||||
<string name="permlab_weather_write">Wetterdatenanbieter aktualisieren</string>
|
||||
<string name="permdesc_weather_write">Ermöglicht der App, Inhalte des Wetterdatenanbieters zu aktualisieren.</string>
|
||||
<string name="permlab_weather_bind">Anbindung als Service für Wetterdatenanbieter</string>
|
||||
<string name="permdesc_weather_bind">Ermöglicht der App, sich als Wetterdatenanbieter zu identifizieren.</string>
|
||||
<string name="permlab_weather_access_mgr">auf Wetterdienst zugreifen</string>
|
||||
<string name="permdesc_weather_access_mgr">Ermöglicht der App, auf den Wetterdienst des Systems zuzugreifen. Wird für normale Apps nicht benötigt.</string>
|
||||
<string name="permlab_dataUsageWrite">Datennutzung-Datenbank ändern</string>
|
||||
<string name="permdesc_dataUsageWrite">Ermöglicht der App, Inhalte der Datennutzungs-Datenbank zu aktualisieren.</string>
|
||||
<string name="permlab_dataUsageRead">Datennutzungs-Datenbank lesen</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">Το LiveDisplay άλλαξε σε λειτουργία εξωτερικού χώρου.</string>
|
||||
<string name="permlab_perfAccess">πρόσβαση στην υπηρεσία επιδόσεων</string>
|
||||
<string name="permdesc_perfAccessDesc">Επιτρέπει σε μια εφαρμογή την πρόσβαση στην υπηρεσία επιδόσεων. Δεν πρέπει να απαιτείται από κανονικές εφαρμογές.</string>
|
||||
<string name="permlab_weather_read">ανάγνωση καιρού</string>
|
||||
<string name="permdesc_weather_read">Επιτρέπει σε μια εφαρμογή να διαβάσει περιεχόμενο από την υπηρεσία παροχής καιρού.</string>
|
||||
<string name="permlab_weather_write">ενημέρωση παρόχου καιρού</string>
|
||||
<string name="permdesc_weather_write">Επιτρέπει σε μια εφαρμογή να ενημερώσει το περιεχόμενο της υπηρεσίας παροχής καιρού.</string>
|
||||
<string name="permlab_weather_bind">σύνδεση ως υπηρεσία παροχής καιρού</string>
|
||||
<string name="permdesc_weather_bind">Επιτρέπει σε μια εφαρμογή να προσδιοριστεί ως μια υπηρεσία παροχής καιρού.</string>
|
||||
<string name="permlab_weather_access_mgr">πρόσβαση στην υπηρεσία καιρού</string>
|
||||
<string name="permdesc_weather_access_mgr">Επιτρέπει σε μια εφαρμογή την πρόσβαση στην υπηρεσία καιρού στο σύστημα. Δεν πρέπει να απαιτείται από κανονικές εφαρμογές.</string>
|
||||
<string name="permlab_dataUsageWrite">τροποποίηση βάσης δεδομένων χρήσης δεδομένων</string>
|
||||
<string name="permdesc_dataUsageWrite">Επιτρέπει σε μια εφαρμογή να ενημερώσει το περιεχόμενο της βάσης δεδομένων χρήσης δεδομένων.</string>
|
||||
<string name="permlab_dataUsageRead">ανάγνωση βάσης δεδομένων χρήσης δεδομένων</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay changed to outdoor mode.</string>
|
||||
<string name="permlab_perfAccess">access performance manager</string>
|
||||
<string name="permdesc_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_weather_read">read weather</string>
|
||||
<string name="permdesc_weather_read">Allows an app to read content from the weather provider.</string>
|
||||
<string name="permlab_weather_write">update weather provider</string>
|
||||
<string name="permdesc_weather_write">Allows an app to update the content of the weather provider.</string>
|
||||
<string name="permlab_weather_bind">bind as a weather provider service</string>
|
||||
<string name="permdesc_weather_bind">Allows an app to be identified as a weather provider service.</string>
|
||||
<string name="permlab_weather_access_mgr">access weather service</string>
|
||||
<string name="permdesc_weather_access_mgr">Allows an app to access the weather service in the system. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_dataUsageWrite">modify data usage database</string>
|
||||
<string name="permdesc_dataUsageWrite">Allows an app to update the content of the data usage database.</string>
|
||||
<string name="permlab_dataUsageRead">read data usage database</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay changed to outdoor mode.</string>
|
||||
<string name="permlab_perfAccess">access performance manager</string>
|
||||
<string name="permdesc_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_weather_read">read weather</string>
|
||||
<string name="permdesc_weather_read">Allows an app to read content from the weather provider.</string>
|
||||
<string name="permlab_weather_write">update weather provider</string>
|
||||
<string name="permdesc_weather_write">Allows an app to update the content of the weather provider.</string>
|
||||
<string name="permlab_weather_bind">bind as a weather provider service</string>
|
||||
<string name="permdesc_weather_bind">Allows an app to be identified as a weather provider service.</string>
|
||||
<string name="permlab_weather_access_mgr">access weather service</string>
|
||||
<string name="permdesc_weather_access_mgr">Allows an app to access the weather service in the system. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_dataUsageWrite">modify data usage database</string>
|
||||
<string name="permdesc_dataUsageWrite">Allows an app to update the content of the data usage database.</string>
|
||||
<string name="permlab_dataUsageRead">read data usage database</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay changed to outdoor mode.</string>
|
||||
<string name="permlab_perfAccess">access performance manager</string>
|
||||
<string name="permdesc_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_weather_read">read weather</string>
|
||||
<string name="permdesc_weather_read">Allows an app to read content from the weather provider.</string>
|
||||
<string name="permlab_weather_write">update weather provider</string>
|
||||
<string name="permdesc_weather_write">Allows an app to update the content of the weather provider.</string>
|
||||
<string name="permlab_weather_bind">bind as a weather provider service</string>
|
||||
<string name="permdesc_weather_bind">Allows an app to be identified as a weather provider service.</string>
|
||||
<string name="permlab_weather_access_mgr">access weather service</string>
|
||||
<string name="permdesc_weather_access_mgr">Allows an app to access the weather service in the system. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_dataUsageWrite">modify data usage database</string>
|
||||
<string name="permdesc_dataUsageWrite">Allows an app to update the content of the data usage database.</string>
|
||||
<string name="permlab_dataUsageRead">read data usage database</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay changed to outdoor mode.</string>
|
||||
<string name="permlab_perfAccess">access performance manager</string>
|
||||
<string name="permdesc_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_weather_read">read weather</string>
|
||||
<string name="permdesc_weather_read">Allows an app to read content from the weather provider.</string>
|
||||
<string name="permlab_weather_write">update weather provider</string>
|
||||
<string name="permdesc_weather_write">Allows an app to update the content of the weather provider.</string>
|
||||
<string name="permlab_weather_bind">bind as a weather provider service</string>
|
||||
<string name="permdesc_weather_bind">Allows an app to be identified as a weather provider service.</string>
|
||||
<string name="permlab_weather_access_mgr">access weather service</string>
|
||||
<string name="permdesc_weather_access_mgr">Allows an app to access the weather service in the system. Should never be needed for normal apps.</string>
|
||||
<string name="permlab_dataUsageWrite">modify data usage database</string>
|
||||
<string name="permdesc_dataUsageWrite">Allows an app to update the content of the data usage database.</string>
|
||||
<string name="permlab_dataUsageRead">read data usage database</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay cambió a modo exterior.</string>
|
||||
<string name="permlab_perfAccess">acceso al gestor de rendimiento</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite que la aplicación acceda al servicio de rendimiento. Nunca debería ser necesario para aplicaciones normales.</string>
|
||||
<string name="permlab_weather_read">leer datos climáticos</string>
|
||||
<string name="permdesc_weather_read">Permite a una aplicación leer contenido desde el proveedor climático.</string>
|
||||
<string name="permlab_weather_write">actualizar proveedor climático</string>
|
||||
<string name="permdesc_weather_write">Permite a una aplicación actualizar el contenido del proveedor climático.</string>
|
||||
<string name="permlab_weather_bind">establecer como servicio del proveedor climático</string>
|
||||
<string name="permdesc_weather_bind">Permite que una aplicación sea identificada como un servicio del proveedor climático.</string>
|
||||
<string name="permlab_weather_access_mgr">acceder al servicio meteorológico</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite a una aplicación acceder al servicio meteorológico en el sistema. Nunca debería ser necesario para aplicaciones normales.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar datos de uso de la base de datos</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite que una aplicación actualice los datos del contenido de la base de datos.</string>
|
||||
<string name="permlab_dataUsageRead">leer datos de uso de la base de datos</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay cambiado a modo exterior.</string>
|
||||
<string name="permlab_perfAccess">acceder al supervisor de rendimiento</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite que la aplicación acceda al servicio de rendimiento. Nunca debería ser necesario para aplicaciones normales.</string>
|
||||
<string name="permlab_weather_read">leer el tiempo</string>
|
||||
<string name="permdesc_weather_read">Permite una aplicación leer contenido desde el proveedor de clima.</string>
|
||||
<string name="permlab_weather_write">actualizar proveedor de clima</string>
|
||||
<string name="permdesc_weather_write">Permite una aplicación actualizar el contenido del proveedor de clima.</string>
|
||||
<string name="permlab_weather_bind">establecer como un servicio de proveedor de clima</string>
|
||||
<string name="permdesc_weather_bind">Permite que una aplicación sea identificada como un servicio de proveedor de clima.</string>
|
||||
<string name="permlab_weather_access_mgr">acceder al servicio de clima</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite a una aplicación acceder al servicio de clima en el sistema. Nunca debe ser necesario para aplicaciones normales.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar datos de uso de la base de datos</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite que una aplicación actualice los datos del contenido de la base de datos.</string>
|
||||
<string name="permlab_dataUsageRead">leer datos de uso de la base de datos</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay muudetud õuerežiimi.</string>
|
||||
<string name="permlab_perfAccess">ligipääs jõudlusehaldurisse</string>
|
||||
<string name="permdesc_perfAccessDesc">Lubab rakendusel pääseda juurde jõudluse teenusele. Tavarakenduste puhul ei peaks kunagi vaja minema.</string>
|
||||
<string name="permlab_weather_read">ilma lugemine</string>
|
||||
<string name="permdesc_weather_read">Lubab rakendusel lugeda ilmateenuse pakkuja sisu.</string>
|
||||
<string name="permlab_weather_write">ilmateenuse pakkuja uuendamine</string>
|
||||
<string name="permdesc_weather_write">Lubab rakendusel uuendada ilmateenuse pakkuja sisu.</string>
|
||||
<string name="permlab_weather_bind">sidumine ilmateenuse pakkuja teenusena</string>
|
||||
<string name="permdesc_weather_bind">Lubab rakendust end tuvastada ilmateenuse pakkuja teenusena.</string>
|
||||
<string name="permlab_weather_access_mgr">ligipääs ilmateenuse pakkuja teenusesse</string>
|
||||
<string name="permdesc_weather_access_mgr">Annab rakendusele ligipääsu ilmateenusele. Tavarakenduste puhul ei peaks kunagi vaja minema.</string>
|
||||
<string name="permlab_dataUsageWrite">andmekasutuse andmebaasi muutmine</string>
|
||||
<string name="permdesc_dataUsageWrite">Lubab rakendusel värskendada andmekasutuse andmebaasi sisu.</string>
|
||||
<string name="permlab_dataUsageRead">andmekasutuse andmebaasi lugemine</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay kaleko modura aldatu da.</string>
|
||||
<string name="permlab_perfAccess">errendimendu kudeatzailea atzitu</string>
|
||||
<string name="permdesc_perfAccessDesc">Errendimendu kudeatzailea atzitzea ahalbidetzen dio aplikazioari. Aplikazio arruntek ez dute hau behar.</string>
|
||||
<string name="permlab_weather_read">eguraldia irakurri</string>
|
||||
<string name="permdesc_weather_read">Eguraldi hornitzailetik edukia irakurtzea ahalbidetzen dio aplikazioari.</string>
|
||||
<string name="permlab_weather_write">eguraldi hornitzailea eguneratu</string>
|
||||
<string name="permdesc_weather_write">Eguraldi hornitzailearen edukia eguneratzea ahalbidetzen dio aplikazioari.</string>
|
||||
<string name="permlab_weather_bind">eguraldi hornitzaile zerbitzu gisa lotu</string>
|
||||
<string name="permdesc_weather_bind">Eguraldi hornitzaile zerbitzu gisa identifikatzea ahalbidetzen dio aplikazioari.</string>
|
||||
<string name="permlab_weather_access_mgr">eguraldi zerbitzua atzitzea</string>
|
||||
<string name="permdesc_weather_access_mgr">Sistemako eguraldi zerbitzura sartzea ahalbidetzen dio aplikazioari. Aplikazio arruntek ez dute hau behar.</string>
|
||||
<string name="permlab_dataUsageWrite">datu erabileraren datu-basea aldatu</string>
|
||||
<string name="permdesc_dataUsageWrite">Datu erabileraren datu-baseko edukiak eguneratzea ahalbidetzen dio aplikazioari.</string>
|
||||
<string name="permlab_dataUsageRead">datu erabilera errealaren datu-basea</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay asetettu ulkoilmatilaan.</string>
|
||||
<string name="permlab_perfAccess">pääse suorituskyvyn hallintaan</string>
|
||||
<string name="permdesc_perfAccessDesc">Sallii sovelluksen pääsyn suorityskyvyn hallinnan palveluun. Tavalliset sovellukset eivät koskaan tarvitse tätä.</string>
|
||||
<string name="permlab_weather_read">lue säätä</string>
|
||||
<string name="permdesc_weather_read">Sallii sovelluksen lukea sisältöä säätarjoajalta.</string>
|
||||
<string name="permlab_weather_write">päivitä säätarjoajaa</string>
|
||||
<string name="permdesc_weather_write">Sallii sovelluksen päivittää säätarjoajan sisältöä.</string>
|
||||
<string name="permlab_weather_bind">aseta säätarjoajapalveluksi</string>
|
||||
<string name="permdesc_weather_bind">Sallii sovellusta käytettävän säätarjoajapalveluna.</string>
|
||||
<string name="permlab_weather_access_mgr">pääsy sääpalveluun</string>
|
||||
<string name="permdesc_weather_access_mgr">Sallii sovelluksen päästä järjestelmän sääpalveluun. Tavalliset sovellukset ei koskaan tarvitse tätä.</string>
|
||||
<string name="permlab_dataUsageWrite">muokkaa datan käytön tietokantaa</string>
|
||||
<string name="permdesc_dataUsageWrite">Sallii sovelluksen päivittää datan käytön tietokantaa.</string>
|
||||
<string name="permlab_dataUsageRead">lue datan käytön tietokantaa</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay changé en mode extérieur.</string>
|
||||
<string name="permlab_perfAccess">accéder au gestionnaire des performances</string>
|
||||
<string name="permdesc_perfAccessDesc">Permet à l\'application d\'accéder au service de performances. Une application normale ne devrait pas en avoir besoin.</string>
|
||||
<string name="permlab_weather_read">lire la météo</string>
|
||||
<string name="permdesc_weather_read">Autorise une application à lire le contenu du fournisseur météo.</string>
|
||||
<string name="permlab_weather_write">mettre à jour le fournisseur de météo</string>
|
||||
<string name="permdesc_weather_write">Autorise une application à mettre à jour le contenu du fournisseur météo.</string>
|
||||
<string name="permlab_weather_bind">lier en tant que service de fournisseur de météo</string>
|
||||
<string name="permdesc_weather_bind">Permet à une application d\'être identifiée en tant que fournisseur de météo.</string>
|
||||
<string name="permlab_weather_access_mgr">accéder au service météo</string>
|
||||
<string name="permdesc_weather_access_mgr">Autorise une application à accéder au service météorologique dans le système. Cette fonctionnalité ne devrait jamais être nécessaire pour les applications standards.</string>
|
||||
<string name="permlab_dataUsageWrite">modifier la base de données d\'utilisation des données</string>
|
||||
<string name="permdesc_dataUsageWrite">Permet à une application de mettre à jour le contenu de la base de données d\'utilisation des données.</string>
|
||||
<string name="permlab_dataUsageRead">lire la base de données d\'utilisation des données</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay wizige nei bûtenstân.</string>
|
||||
<string name="permlab_perfAccess">tagong ta prestaasjebehear</string>
|
||||
<string name="permdesc_perfAccessDesc">Hjirmei kin de app tagong krije ta de prestaasjetsjinst. Nea fereaske foar normale apps.</string>
|
||||
<string name="permlab_weather_read">it waar lêze</string>
|
||||
<string name="permdesc_weather_read">Hjirmei kin de app de ynhâld fan de waaroanbieder lêze.</string>
|
||||
<string name="permlab_weather_write">Waaroanbieder fernije</string>
|
||||
<string name="permdesc_weather_write">Hjirmei kin de app de ynhâld fan de waaroanbieder fernije.</string>
|
||||
<string name="permlab_weather_bind">keppelje as waaroanbiedertsjinst</string>
|
||||
<string name="permdesc_weather_bind">Hjirmei kin de app harren identifisearje as waaroanbiedertsjinst.</string>
|
||||
<string name="permlab_weather_access_mgr">tagong ta waartsjinst</string>
|
||||
<string name="permdesc_weather_access_mgr">Hjirmei kin de app tagong krije ta de waartsjinst. Nea fereaske foar normale apps.</string>
|
||||
<string name="permlab_dataUsageWrite">database gegevensgebrûk oanpasse</string>
|
||||
<string name="permdesc_dataUsageWrite">Hjirmei kin de app de ynhâld fan de database mei gegevensgebrûk bywurkje.</string>
|
||||
<string name="permlab_dataUsageRead">database gegevensgebrûk lêze</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">Chaidh LiveDisplay atharrachadh gu modh an taoibh a-muigh.</string>
|
||||
<string name="permlab_perfAccess">manaidsear an dèanadais inntrigeadh</string>
|
||||
<string name="permdesc_perfAccessDesc">Leigidh seo le aplacaid seirbheis an dèanadais inntrigeadh. Chan eil seo gu feum do dh’aplacaidean àbhaisteach idir.</string>
|
||||
<string name="permlab_weather_read">an aimsir a leughadh</string>
|
||||
<string name="permdesc_weather_read">Leigidh seo le aplacaid susbaint o sholaraiche na h-aimsire a leughadh.</string>
|
||||
<string name="permlab_weather_write">solaraiche aimsire ùrachadh</string>
|
||||
<string name="permdesc_weather_write">Leigidh seo le aplacaid susbaint aig solaraiche na h-aimsire ùrachadh.</string>
|
||||
<string name="permlab_weather_bind">aimsir a sholar ’na seirbheis</string>
|
||||
<string name="permdesc_weather_bind">Leigidh seo le aplacaid gun dèid a h-aithneachadh mar seirbheis solaraiche aimsire.</string>
|
||||
<string name="permlab_weather_access_mgr">seirbheis aimsire inntrigeadh</string>
|
||||
<string name="permdesc_weather_access_mgr">Leigidh seo le aplacaid seirbheis na h-aimsire inntrigeadh san t-siostam. Chan eil seo gu feum do dh’aplacaidean àbhaisteach idir.</string>
|
||||
<string name="permlab_dataUsageWrite">an stòr-dàta air caitheamh dàta atharrachadh</string>
|
||||
<string name="permdesc_dataUsageWrite">Leigidh seo le aplacaid susbaint an stòir-dhàta air caitheamh dàta atharrachadh.</string>
|
||||
<string name="permlab_dataUsageRead">an stòr-dàta air caitheamh dàta a leughadh</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay mudado ao modo exteriores.</string>
|
||||
<string name="permlab_perfAccess">acceso ao xestor de rendemento</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite que unha aplicación acceda ao servizo de rendemento. Non debería ser necesario para aplicación normais.</string>
|
||||
<string name="permlab_weather_read">ler o tempo</string>
|
||||
<string name="permdesc_weather_read">Permite que unha aplicación ler o contido desde o fornecedor de clima.</string>
|
||||
<string name="permlab_weather_write">actualizar o fornecedor de clima</string>
|
||||
<string name="permdesc_weather_write">Permite que unha aplicación actualice o contido do fornecedor do clima.</string>
|
||||
<string name="permlab_weather_bind">establecer como un servizo fornecedor de clima</string>
|
||||
<string name="permdesc_weather_bind">Permite que unha aplicación poida ser identificada como un servizo fornecedor de clima.</string>
|
||||
<string name="permlab_weather_access_mgr">acceder ao servizo de clima</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite que unha aplicación acceder ao servizo de clima do sistema. Nunca debería ser necesario para aplicacións normais.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar os datos de uso da base de datos</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite que unha aplicación poida actualizar os datos do contido da base de datos.</string>
|
||||
<string name="permlab_dataUsageRead">ler os datos de uso da base de datos</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay promijenjen u vanjski način.</string>
|
||||
<string name="permlab_perfAccess">pristup upravitelju performansi</string>
|
||||
<string name="permdesc_perfAccessDesc">Dopušta aplikaciji pristup servisu performansi. Za obične aplikacije nikada ne bi trebao biti potreban.</string>
|
||||
<string name="permlab_weather_read">čitanje vremenske prognoze</string>
|
||||
<string name="permdesc_weather_read">Dopušta aplikaciji čitati sadržaj vremenske prognoze.</string>
|
||||
<string name="permlab_weather_write">ažuriranje vremenske prognoze</string>
|
||||
<string name="permdesc_weather_write">Dopušta aplikaciji ažurirati sadržaj vremenske prognoze.</string>
|
||||
<string name="permlab_weather_bind">povezan kao dobavljač vremenske prognoze</string>
|
||||
<string name="permdesc_weather_bind">Dopušta aplikaciji da se identificira kao dobavljač vremenske prognoze.</string>
|
||||
<string name="permlab_weather_access_mgr">pristup usluzi vremenske prognoze</string>
|
||||
<string name="permdesc_weather_access_mgr">Omogućuje aplikaciji pristupiti uslugama vremenske prognoze u sustavu. Nije potrebno normalnim aplikacijama.</string>
|
||||
<string name="permlab_dataUsageWrite">izmijena baze podataka podatkovnog prometa</string>
|
||||
<string name="permdesc_dataUsageWrite">Aplikaciji omogućuje ažuriranje sadržaja baze podataka s podacima.</string>
|
||||
<string name="permlab_dataUsageRead">čitanje upotrebe baze podataka</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay szabadtéri módra változtatva.</string>
|
||||
<string name="permlab_perfAccess">hozzáférés a teljesítmény kezelőhöz</string>
|
||||
<string name="permdesc_perfAccessDesc">Lehetővé teszi az alkalmazás számára, hogy hozzáférjen a teljesítmény szolgáltatáshoz. Általános alkalmazásoknak soha nem kell ilyen engedély.</string>
|
||||
<string name="permlab_weather_read">időjárás olvasása</string>
|
||||
<string name="permdesc_weather_read">Lehetővé teszi az alkalmazás számára az időjárás szolgáltatói tartalom olvasását.</string>
|
||||
<string name="permlab_weather_write">időjárás szolgáltató frissítése</string>
|
||||
<string name="permdesc_weather_write">Lehetővé teszi az alkalmazás számár, hogy frissítse az időjárás szolgáltató tartalmát.</string>
|
||||
<string name="permlab_weather_bind">időjárás szolgáltatóként kötés</string>
|
||||
<string name="permdesc_weather_bind">Lehetővé teszi az alkalmazás számára, hogy mint időjárás szolgáltató kerüljön azonosításra.</string>
|
||||
<string name="permlab_weather_access_mgr">hozzáférés időjárás szolgáltatáshoz</string>
|
||||
<string name="permdesc_weather_access_mgr">Lehetővé teszi az alkalmazás számára a rendszer időjárás szolgáltatásának elérését. Általános alkalmazásoknak soha nem kell ilyen engedély.</string>
|
||||
<string name="permlab_dataUsageWrite">adathasználati adatbázis módosítása</string>
|
||||
<string name="permdesc_dataUsageWrite">Lehetővé teszi az alkalmazás számára az adathasználati adatbázis tartalmának frissítését.</string>
|
||||
<string name="permlab_dataUsageRead">adathasználati adatbázis olvasása</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay diubah menjadi modus luar ruangan.</string>
|
||||
<string name="permlab_perfAccess">akses pengelola kinerja</string>
|
||||
<string name="permdesc_perfAccessDesc">Izinkan aplikasi untuk mengakses layanan kinerja. Tidak dibutuhkan untuk aplikasi biasa.</string>
|
||||
<string name="permlab_weather_read">baca cuaca</string>
|
||||
<string name="permdesc_weather_read">Izinkan aplikasi untuk membaca konten dari penyedia cuaca.</string>
|
||||
<string name="permlab_weather_write">perbarui penyedia cuaca</string>
|
||||
<string name="permdesc_weather_write">Izinkan aplikasi untuk memperbarui konten dari penyedia cuaca.</string>
|
||||
<string name="permlab_weather_bind">ikat sebagai layanan penyedia cuaca</string>
|
||||
<string name="permdesc_weather_bind">Izinkan aplikasi untuk diidentifikasi sebagai layanan penyedia cuaca.</string>
|
||||
<string name="permlab_weather_access_mgr">akses layanan cuaca</string>
|
||||
<string name="permdesc_weather_access_mgr">Izinkan aplikasi untuk mengakses layanan cuaca dalam sistem. Tidak dibutuhkan untuk aplikasi biasa.</string>
|
||||
<string name="permlab_dataUsageWrite">ubah basis data penggunaan data</string>
|
||||
<string name="permdesc_dataUsageWrite">Izinkan aplikasi untuk memperbarui konten dari basis data penggunaan data.</string>
|
||||
<string name="permlab_dataUsageRead">baca basis data penggunaan data</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay cambiato in modalità all\'aperto.</string>
|
||||
<string name="permlab_perfAccess">accesso gestione performance</string>
|
||||
<string name="permdesc_perfAccessDesc">Consente ad un\'app di accedere alla gestione performances. Non dovrebbe essere mai richiesto per le normali app.</string>
|
||||
<string name="permlab_weather_read">leggi meteo</string>
|
||||
<string name="permdesc_weather_read">Consente all\'applicazione di leggere contenuti dal provider meteo.</string>
|
||||
<string name="permlab_weather_write">aggiorna provider meteo</string>
|
||||
<string name="permdesc_weather_write">Consente all\'applicazione di aggiornare contenuti nel provider meteo.</string>
|
||||
<string name="permlab_weather_bind">identificazione come provider meteo</string>
|
||||
<string name="permdesc_weather_bind">Consente all\'applicazione di identificarsi come provider meteo.</string>
|
||||
<string name="permlab_weather_access_mgr">accesso servizio meteo</string>
|
||||
<string name="permdesc_weather_access_mgr">Consente all\'applicazione di accedere al servizio meteo nel sistema. Non dovrebbe mai essere necessario per le app normali.</string>
|
||||
<string name="permlab_dataUsageWrite">modifica database utilizzo dati</string>
|
||||
<string name="permdesc_dataUsageWrite">Consente all\'applicazione di aggiornare i contenuti nel database dati utilizzati.</string>
|
||||
<string name="permlab_dataUsageRead">leggi database utilizzo dati</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay שונה למצב חוץ.</string>
|
||||
<string name="permlab_perfAccess">גש למנהל הביצועים</string>
|
||||
<string name="permdesc_perfAccessDesc">מאפשר ליישום לגשת לשירות ניהול הביצועים. לא אמור להידרש ליישומים רגילים לעולם.</string>
|
||||
<string name="permlab_weather_read">קרא את מזג האוויר</string>
|
||||
<string name="permdesc_weather_read">מאפשר ליישום לקרוא תוכן של ספק מידע על מזג האוויר.</string>
|
||||
<string name="permlab_weather_write">עדכן את ספק מזג האוויר</string>
|
||||
<string name="permdesc_weather_write">מאפשר ליישום לעדכן את תוכן ספק מידע מזג האוויר.</string>
|
||||
<string name="permlab_weather_bind">התקשרות לשירות ספק מזג האוויר</string>
|
||||
<string name="permdesc_weather_bind">מאפשר ליישום להזדהות כספק מידע מזג אוויר.</string>
|
||||
<string name="permlab_weather_access_mgr">גישה לשירות מידע מזג אוויר</string>
|
||||
<string name="permdesc_weather_access_mgr">מאפשר ליישום לגשת לשירות מזג האוויר של המערכת. לא אמור להידרש ליישומים רגילים לעולם.</string>
|
||||
<string name="permlab_dataUsageWrite">שנה מסד נתונים של השימוש בנתונים</string>
|
||||
<string name="permdesc_dataUsageWrite">מאפשר ליישום לעדכן את תוכן מסד הנתונים של השימוש בנתונים.</string>
|
||||
<string name="permlab_dataUsageRead">קרא את מסד הנתונים של השימוש בנתונים</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplayが屋外モードに変更されました。</string>
|
||||
<string name="permlab_perfAccess">パフォーマンスマネージャーへのアクセス</string>
|
||||
<string name="permdesc_perfAccessDesc">パフォーマンスサービスへのアクセスをアプリに許可します。通常のアプリで必要とされることはありません。</string>
|
||||
<string name="permlab_weather_read">天気の読み取り</string>
|
||||
<string name="permdesc_weather_read">天気プロバイダからのコンテンツの読み取りをアプリに許可します。</string>
|
||||
<string name="permlab_weather_write">天気プロバイダの更新</string>
|
||||
<string name="permdesc_weather_write">天気プロバイダのコンテンツの更新をアプリに許可します。</string>
|
||||
<string name="permlab_weather_bind">天気プロバイダサービスとしてのバインド</string>
|
||||
<string name="permdesc_weather_bind">天気プロバイダサービスとして識別されることをアプリに許可します。</string>
|
||||
<string name="permlab_weather_access_mgr">天気サービスへのアクセス</string>
|
||||
<string name="permdesc_weather_access_mgr">システムの天気サービスへのアクセスをアプリに許可します。通常のアプリで必要とされることはありません。</string>
|
||||
<string name="permlab_dataUsageWrite">データ使用量データベースの変更</string>
|
||||
<string name="permdesc_dataUsageWrite">データ使用量データベースのコンテンツの更新をアプリに許可します。</string>
|
||||
<string name="permlab_dataUsageRead">データ使用量データベースの読み取り</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay ಹೊರಾಂಗಣ ರೀತಿಗೆ ಬದಲಾಗಿದೆ.</string>
|
||||
<string name="permlab_perfAccess">ಕಾರ್ಯಕ್ಷಮತೆ ನಿರ್ವಾಹಕ ಪ್ರವೇಶ</string>
|
||||
<string name="permdesc_perfAccessDesc">ಕಾರ್ಯಕ್ಷಮತೆ ಸೇವೆಯನ್ನು ಬಳಸಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ. ಸಾಮಾನ್ಯ ಆಪ್ಗಳಿಗೆ ಇದರ ಅಗತ್ಯವೇ ಇರುವುದಿಲ್ಲ.</string>
|
||||
<string name="permlab_weather_read">ಹವಾಮಾನ ಓದು</string>
|
||||
<string name="permdesc_weather_read">ಹವಾಮಾನ ಪರಿಚಾರಕರ ಘಟಕಗಳನ್ನು ಓದಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ.</string>
|
||||
<string name="permlab_weather_write">ಹವಾಮಾನ ಪರಿಚಾರಕವನ್ನು ನವೀಕರಿಸು</string>
|
||||
<string name="permdesc_weather_write">ಹವಾಮಾನ ಪರಿಚಾರಕದ ಘಟಕಗಳನ್ನು ನವೀಕರಿಸಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ.</string>
|
||||
<string name="permlab_weather_bind">ಹವಾಮಾನ ಪರಿಚಾರಕ ಸೇವೆಯಾಗಿ ಸಂಯೋಜಿಸು</string>
|
||||
<string name="permdesc_weather_bind">ಹವಾಮಾನ ಪರಿಚಾರಕ ಎಂದು ಗುರುತಿಸಿಕೊಳ್ಳಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ.</string>
|
||||
<string name="permlab_weather_access_mgr">ಹವಾಮಾನ ಸೇವೆ ಪ್ರವೇಶ</string>
|
||||
<string name="permdesc_weather_access_mgr">ವ್ಯವಸ್ಥೆಯಲ್ಲಿನ ಹವಾಮಾನ ಸೇವೆಯನ್ನು ಬಳಸಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ. ಸಾಮಾನ್ಯ ಆಪ್ಗಳಿಗೆ ಇದರ ಅಗತ್ಯವೇ ಇರುವುದಿಲ್ಲ.</string>
|
||||
<string name="permlab_dataUsageWrite">ದತ್ತಾಂಶ ಬಳಕೆಯ ದತ್ತಸಂಚಯವನ್ನು ಬದಲಿಸು</string>
|
||||
<string name="permdesc_dataUsageWrite">ದತ್ತಾಂಶ ಬಳಕೆಯ ದತ್ತಸಂಚಯ ಘಟಕಗಳನ್ನು ನವೀಕರಿಸಲು ಆಪ್ಗೆ ಅನುಮತಿಸುತ್ತದೆ.</string>
|
||||
<string name="permlab_dataUsageRead">ದತ್ತಾಂಶ ಬಳಕೆಯ ದತ್ತಸಂಚಯವನ್ನು ಓದು</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">라이브 디스플레이가 야외 모드로 바뀜.</string>
|
||||
<string name="permlab_perfAccess">성능 관리자에 액세스</string>
|
||||
<string name="permdesc_perfAccessDesc">앱이 성능 서비스에 접근할 수 있도록 허용합니다. 일반 앱에서는 필요 없는 권한입니다.</string>
|
||||
<string name="permlab_weather_read">날씨 확인</string>
|
||||
<string name="permdesc_weather_read">앱이 날씨 제공자로부터 날씨를 확인할 수 있도록 허용합니다.</string>
|
||||
<string name="permlab_weather_write">날씨 제공자 업데이트</string>
|
||||
<string name="permdesc_weather_write">앱이 날씨 제공자를 업데이트할 수 있도록 허용합니다.</string>
|
||||
<string name="permlab_weather_bind">날씨 제공자 서비스로 연결</string>
|
||||
<string name="permdesc_weather_bind">앱이 날씨 제공자 서비스로 인식되는 것을 허용합니다.</string>
|
||||
<string name="permlab_weather_access_mgr">날씨 서비스에 접근</string>
|
||||
<string name="permdesc_weather_access_mgr">앱이 시스템의 날씨 서비스에 접근할 수 있도록 허용합니다. 일반 앱에서는 필요 없는 권한입니다.</string>
|
||||
<string name="permlab_dataUsageWrite">데이터 사용량 데이터베이스 수정</string>
|
||||
<string name="permdesc_dataUsageWrite">앱이 데이터 사용량 데이터베이스를 수정할 수 있도록 허용합니다.</string>
|
||||
<string name="permlab_dataUsageRead">데이터 사용량 데이터베이스 읽기</string>
|
||||
|
||||
@@ -66,14 +66,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay endret til utendørs modus.</string>
|
||||
<string name="permlab_perfAccess">tilgang til ytelsesadministrereren</string>
|
||||
<string name="permdesc_perfAccessDesc">Tillater en app å få tilgang til ytelses-tjenesten. Dette skulle aldri vært nødvendig for normale apper.</string>
|
||||
<string name="permlab_weather_read">lese vær</string>
|
||||
<string name="permdesc_weather_read">Tillater en app å lese av innholdet fra værleverandøren.</string>
|
||||
<string name="permlab_weather_write">oppdatere værleverandør</string>
|
||||
<string name="permdesc_weather_write">Tillater en app å oppdatere innholdet til vær leverandøren.</string>
|
||||
<string name="permlab_weather_bind">bind som en værleverandør tjeneste</string>
|
||||
<string name="permdesc_weather_bind">Tillater en app å bli identifisert som en værleverandør tjeneste.</string>
|
||||
<string name="permlab_weather_access_mgr">få tilgang til værtjeneste</string>
|
||||
<string name="permdesc_weather_access_mgr">Tillater en app å få tilgang til værtjenesten i systemet. Skal aldri være nødvendig for normale apper.</string>
|
||||
<string name="permlab_dataUsageWrite">endre databruk databasen</string>
|
||||
<string name="permdesc_dataUsageWrite">Tillater en app å oppdatere innholdet til databruk databasen.</string>
|
||||
<string name="permlab_dataUsageRead">lese av databruk databasen</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay gewijzigd naar buitenstand.</string>
|
||||
<string name="permlab_perfAccess">toegang tot prestatiebeheer</string>
|
||||
<string name="permdesc_perfAccessDesc">Hiermee kan de app toegang krijgen tot de prestatieservice. Nooit vereist voor normale apps.</string>
|
||||
<string name="permlab_weather_read">weer lezen</string>
|
||||
<string name="permdesc_weather_read">Hiermee kan de app de inhoud van de weeraanbieder lezen.</string>
|
||||
<string name="permlab_weather_write">weeraanbieder vernieuwen</string>
|
||||
<string name="permdesc_weather_write">Hiermee kan de app de inhoud van de weeraanbieder vernieuwen.</string>
|
||||
<string name="permlab_weather_bind">koppelen als weeraanbiederservice</string>
|
||||
<string name="permdesc_weather_bind">Hiermee kan de app zich identificeren als weeraanbiederservice.</string>
|
||||
<string name="permlab_weather_access_mgr">toegang tot weerservice</string>
|
||||
<string name="permdesc_weather_access_mgr">Hiermee kan de app toegang krijgen tot de weerservice van het systeem. Nooit vereist voor normale apps.</string>
|
||||
<string name="permlab_dataUsageWrite">gegevensgebruik-database aanpassen</string>
|
||||
<string name="permdesc_dataUsageWrite">Hiermee kan de app de inhoud van de database met gegevensgebruik bijwerken.</string>
|
||||
<string name="permlab_dataUsageRead">gegevensgebruik-database lezen</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay zmieniony na tryb zewnętrzny.</string>
|
||||
<string name="permlab_perfAccess">dostęp do menedżera wydajności</string>
|
||||
<string name="permdesc_perfAccessDesc">Umożliwia aplikacji dostęp do usługi wydajności (nie powinno być wymagane przez standardowe aplikacje).</string>
|
||||
<string name="permlab_weather_read">odczyt pogody</string>
|
||||
<string name="permdesc_weather_read">Umożliwia aplikacji odczyt danych od dostawcy pogody.</string>
|
||||
<string name="permlab_weather_write">aktualizacja dostawcy pogody</string>
|
||||
<string name="permdesc_weather_write">Umożliwia aplikacji na aktualizację danych dostawcy pogody.</string>
|
||||
<string name="permlab_weather_bind">powiąż jako usługa dostawcy pogody</string>
|
||||
<string name="permdesc_weather_bind">Zezwala aplikacji na dostarczanie usługi prognozy pogody.</string>
|
||||
<string name="permlab_weather_access_mgr">dostęp do usługi prognozy pogody</string>
|
||||
<string name="permdesc_weather_access_mgr">Zezwala aplikacji na dostęp do usługi prognozy pogody w systemie. Nie powinno być wymagane przez zwykłe aplikacje.</string>
|
||||
<string name="permlab_dataUsageWrite">modyfikowanie zawartości licznika danych</string>
|
||||
<string name="permdesc_dataUsageWrite">Umożliwia aplikacji aktualizowanie zawartości licznika danych.</string>
|
||||
<string name="permlab_dataUsageRead">odczyt zawartości licznika danych</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay alterado para modo ao ar livre.</string>
|
||||
<string name="permlab_perfAccess">acessar o gerenciador de desempenho</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite que um aplicativo acesse o serviço de desempenho. Nunca deve ser necessário para aplicativos normais.</string>
|
||||
<string name="permlab_weather_read">ler previsão do tempo</string>
|
||||
<string name="permdesc_weather_read">Permite que um aplicativo leia o conteúdo do provedor da previsão do tempo.</string>
|
||||
<string name="permlab_weather_write">atualizar provedor de provisão do tempo</string>
|
||||
<string name="permdesc_weather_write">Permite que um aplicativo atualize o conteúdo do provedor da previsão do tempo.</string>
|
||||
<string name="permlab_weather_bind">vincular-se como um provedor de previsão do tempo</string>
|
||||
<string name="permdesc_weather_bind">Permite que um aplicativo seja identificado como um provedor de previsão de tempo.</string>
|
||||
<string name="permlab_weather_access_mgr">acesso ao serviço de previsão do tempo</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite que um aplicativo acesse a previsão do tempo no sistema. Nunca deverá ser necessário para aplicativos normais.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar o banco de dados de uso de dados</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite um aplicativo a atualizar o conteúdo da base de dados de uso de dados.</string>
|
||||
<string name="permlab_dataUsageRead">ler banco de dados de uso de dados</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay alterado para modo exterior.</string>
|
||||
<string name="permlab_perfAccess">aceder ao gestor de desempenho</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite que uma aplicação aceda ao serviço de desempenho. Nunca deverá ser necessário para aplicações normais.</string>
|
||||
<string name="permlab_weather_read">ler a meteorologia</string>
|
||||
<string name="permdesc_weather_read">Permite que uma aplicação leia conteúdo através do fornecedor de meteorologia.</string>
|
||||
<string name="permlab_weather_write">atualizar o fornecedor de meteorologia</string>
|
||||
<string name="permdesc_weather_write">Permite que uma aplicação atualize o conteúdo do fornecedor de meteorologia.</string>
|
||||
<string name="permlab_weather_bind">vincular-se como um serviço de fornecedor de meteorologia</string>
|
||||
<string name="permdesc_weather_bind">Permite que uma aplicação seja identificada como um serviço de fornecedor de meteorologia.</string>
|
||||
<string name="permlab_weather_access_mgr">aceder ao serviço de meteorologia</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite que uma aplicação aceda ao serviço de meteorologia do sistema. Nunca deverá ser necessário para aplicações normais.</string>
|
||||
<string name="permlab_dataUsageWrite">modificar a base de dados de utilização de dados</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite que uma aplicação atualize o conteúdo da base de dados de utilização de dados.</string>
|
||||
<string name="permlab_dataUsageRead">ler a base de dados de utilização de dados</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay s-a schimbat la modul afară.</string>
|
||||
<string name="permlab_perfAccess">acces la managerul de performanță</string>
|
||||
<string name="permdesc_perfAccessDesc">Permite unei aplicații să acceseze serviciul de performanță. Aplicațiile normale nu au nevoie de aceasta.</string>
|
||||
<string name="permlab_weather_read">citește vremea</string>
|
||||
<string name="permdesc_weather_read">Permite unei aplicații să citească conținutul furnizorului de vreme.</string>
|
||||
<string name="permlab_weather_write">actualizare furnizor meteo</string>
|
||||
<string name="permdesc_weather_write">Permite unei aplicații să actualizeze conținutul furnizorului de vreme.</string>
|
||||
<string name="permlab_weather_bind">fixează ca serviciu furnizor de vreme</string>
|
||||
<string name="permdesc_weather_bind">Permite unei aplicații să fie identificată ca un serviciu furnizor de vreme.</string>
|
||||
<string name="permlab_weather_access_mgr">accesează serviciul pentru vreme</string>
|
||||
<string name="permdesc_weather_access_mgr">Permite unei aplicații să acceseze serviciul pentru vreme în sistem. Aplicațiile normale nu ar trebui să aibă nevoie de aceasta.</string>
|
||||
<string name="permlab_dataUsageWrite">modifică baza de date a utilizării datelor</string>
|
||||
<string name="permdesc_dataUsageWrite">Permite unei aplicații să actualizeze conținutul bazei de date despre utilizarea datelor.</string>
|
||||
<string name="permlab_dataUsageRead">citește baza de date a utilizării datelor</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay переключен в режим «на улице».</string>
|
||||
<string name="permlab_perfAccess">доступ к менеджеру производительности</string>
|
||||
<string name="permdesc_perfAccessDesc">Приложение сможет получать доступ к службе производительности. Это разрешение не используется обычными приложениями.</string>
|
||||
<string name="permlab_weather_read">чтение данных о погоде</string>
|
||||
<string name="permdesc_weather_read">Приложение сможет считывать данные от поставщика погоды.</string>
|
||||
<string name="permlab_weather_write">обновление поставщика погоды</string>
|
||||
<string name="permdesc_weather_write">Приложение сможет обновлять данные поставщика погоды.</string>
|
||||
<string name="permlab_weather_bind">привязать как службу поставщика погоды</string>
|
||||
<string name="permdesc_weather_bind">Приложение сможет выступать в качестве службы поставщика погоды.</string>
|
||||
<string name="permlab_weather_access_mgr">доступ к службе погоды</string>
|
||||
<string name="permdesc_weather_access_mgr">Приложение сможет получать доступ к службе погоды в системе. Это разрешение не используется обычными приложениями.</string>
|
||||
<string name="permlab_dataUsageWrite">изменить данные об использовании БД</string>
|
||||
<string name="permdesc_dataUsageWrite">Приложение сможет обновлять содержимое БД использования данных.</string>
|
||||
<string name="permlab_dataUsageRead">чтение данных об использовании БД</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay sa zmenil na režim vonku.</string>
|
||||
<string name="permlab_perfAccess">prístup k správe výkonu</string>
|
||||
<string name="permdesc_perfAccessDesc">Umožňuje aplikácii prístup k správe výkonu. Toto povolenie nie je bežné pre štandardné aplikácie.</string>
|
||||
<string name="permlab_weather_read">čítať počasie</string>
|
||||
<string name="permdesc_weather_read">Umožní aplikácii čítať obsah z poskytovateľa počasia.</string>
|
||||
<string name="permlab_weather_write">aktualizovať poskytovateľa počasia</string>
|
||||
<string name="permdesc_weather_write">Umožní aplikácii aktualizovať obsah poskytovateľa počasia.</string>
|
||||
<string name="permlab_weather_bind">viazať sa ako služba poskytovateľa počasia</string>
|
||||
<string name="permdesc_weather_bind">Umožní aplikácii identifikovať sa ako služba poskytovateľa počasia.</string>
|
||||
<string name="permlab_weather_access_mgr">prístup k meteorologickej službe</string>
|
||||
<string name="permdesc_weather_access_mgr">Povoliť aplikácií prístup k meteorologickej službe v systéme. Bežné aplikácie by to nemali nikdy vyžadovať.</string>
|
||||
<string name="permlab_dataUsageWrite">meniť databázu využitia dát</string>
|
||||
<string name="permdesc_dataUsageWrite">Umožní aplikácii aktualizovať obsah databázy využitia dát.</string>
|
||||
<string name="permlab_dataUsageRead">čítať databázu využitia dát</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay spremenjen v način na prostem.</string>
|
||||
<string name="permlab_perfAccess">dostop do upravljalnika zmogljivosti</string>
|
||||
<string name="permdesc_perfAccessDesc">Dovoli aplikaciji dostop do storitve zmogljivosti. Navadno ni potrebno za običajne aplikacije.</string>
|
||||
<string name="permlab_weather_read">branje vremena</string>
|
||||
<string name="permdesc_weather_read">Dovoli aplikaciji branje vsebine iz ponudnika vremena.</string>
|
||||
<string name="permlab_weather_write">posodabljanje ponudnika vremena</string>
|
||||
<string name="permdesc_weather_write">Dovoli aplikaciji posodobitev vsebine ponudnika vremena.</string>
|
||||
<string name="permlab_weather_bind">vezava kot storitev ponudnika vremena</string>
|
||||
<string name="permdesc_weather_bind">Dovoli aplikaciji, da se identificira kot storitev ponudnika vremena.</string>
|
||||
<string name="permlab_weather_access_mgr">dostop do storitve vremena</string>
|
||||
<string name="permdesc_weather_access_mgr">Dovoli aplikaciji dostop do storitve vremena v sistemu. Navadno ni potrebno za običajne aplikacije.</string>
|
||||
<string name="permlab_dataUsageWrite">spreminjanje podatkovne zbirke uporabe podatkov</string>
|
||||
<string name="permdesc_dataUsageWrite">Dovoli aplikaciji posodobitev vsebine iz podatkovne zbirke uporabe podatkov.</string>
|
||||
<string name="permlab_dataUsageRead">branje podatkovne zbirke uporabe podatkov</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay u kthye në profilin jashtë shtëpisë.</string>
|
||||
<string name="permlab_perfAccess">hyrja tek menaxhuesi i performancës</string>
|
||||
<string name="permdesc_perfAccessDesc">Lejon një app të hyjë tek shërbimi i performancës. App normale se kanë të nevojshme.</string>
|
||||
<string name="permlab_weather_read">lexo motin</string>
|
||||
<string name="permdesc_weather_read">Lejon një app të lexojë përmbajtjen nga parashkuesi i motit.</string>
|
||||
<string name="permlab_weather_write">përditëso ofruesin e të dhënave të motit</string>
|
||||
<string name="permdesc_weather_write">Lejon një app të përditësojë përmbajtjen e një parashkuesi moti.</string>
|
||||
<string name="permlab_weather_bind">bashkoi si shërbim parashikimi moti</string>
|
||||
<string name="permdesc_weather_bind">Lejon një app të identifikohet si shërbim për parashikuesin e motit.</string>
|
||||
<string name="permlab_weather_access_mgr">akseso shërbimin e motit</string>
|
||||
<string name="permdesc_weather_access_mgr">Lejon një app të hyjë tek shërbimi i parashikimit të motit. App normale se kanë të nevojshme.</string>
|
||||
<string name="permlab_dataUsageWrite">modifiko databazën e përdorimit të internetit</string>
|
||||
<string name="permdesc_dataUsageWrite">Lejon një app të azhornojë përmbajtjen e databazës së përdorimit të internetit.</string>
|
||||
<string name="permlab_dataUsageRead">lexo databazën e përdorimit të internetit</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay је пребачен у режим „на отвореном“.</string>
|
||||
<string name="permlab_perfAccess">приступ менаџеру перформанси</string>
|
||||
<string name="permdesc_perfAccessDesc">Апликација може да приступа услузи перформанси. Ова дозвола није потребна нормалним апликацијама.</string>
|
||||
<string name="permlab_weather_read">читање временске прогнозе</string>
|
||||
<string name="permdesc_weather_read">Апликација може да чита садржај временске прогнозе.</string>
|
||||
<string name="permlab_weather_write">ажурирање временске прогнозе</string>
|
||||
<string name="permdesc_weather_write">Апликација може да ажурира садржај временске прогнозе.</string>
|
||||
<string name="permlab_weather_bind">повезан као добављач временске прогнозе</string>
|
||||
<string name="permdesc_weather_bind">Апликација може да буде добављач временске прогнозе.</string>
|
||||
<string name="permlab_weather_access_mgr">приступ услузи временске прогнозе</string>
|
||||
<string name="permdesc_weather_access_mgr">Апликација може да приступа системској услузи временске прогнозе. Ова дозвола није потребна нормалним апликацијама.</string>
|
||||
<string name="permlab_dataUsageWrite">измена базе о коришћењу података</string>
|
||||
<string name="permdesc_dataUsageWrite">Апликација може да ажурира садржај базе о коришћењу података.</string>
|
||||
<string name="permlab_dataUsageRead">читање базе о коришћењу података</string>
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_night">LiveDisplay: nattläge.</string>
|
||||
<string name="permlab_perfAccess">komma åt prestandahanteraren</string>
|
||||
<string name="permdesc_perfAccessDesc">Ger en app åtkomst till prestandatjänsten. Ska aldrig behövas för vanliga appar.</string>
|
||||
<string name="permlab_weather_read">läsa väderinformation</string>
|
||||
<string name="permlab_weather_write">uppdatera väderleverantör</string>
|
||||
<string name="permlab_manageRemotePrefs">hantera fjärrinställningar</string>
|
||||
<string name="build_date">Kompileringsdatum</string>
|
||||
<string name="lineage_updates">LineageOS-uppdateringar</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay เปลี่ยนเป็นรูปแบบกลางแจ้ง</string>
|
||||
<string name="permlab_perfAccess">ตัวจัดการประสิทธิภาพการเข้าถึง</string>
|
||||
<string name="permdesc_perfAccessDesc">อนุญาตให้แอปเข้าถึงบริการด้านประสิทธิภาพ ซึ่งไม่จำเป็นสำหรับแอปปกติ</string>
|
||||
<string name="permlab_weather_read">อ่านสภาพอากาศ</string>
|
||||
<string name="permdesc_weather_read">อนุญาตให้แอปอ่านเนื้อหาจากบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permlab_weather_write">ปรับปรุงบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permdesc_weather_write">อนุญาตให้แอปสามารถอัพเดทเนื้อหาของบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permlab_weather_bind">ผูกมัดเป็นบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permdesc_weather_bind">อนุญาตให้แอปยืนยันตัวตนเป็นบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permlab_weather_access_mgr">เข้าถึงบริการรายงานสภาพอากาศ</string>
|
||||
<string name="permdesc_weather_access_mgr">อนุญาตให้แอปสามารถจัดการบริการรายงานสภาพอากาศในระบบ ปกติแล้วไม่ต้องการใช้งานในแอปทั่วไป</string>
|
||||
<string name="permlab_dataUsageWrite">แก้ไขฐานข้อมูลการใช้งาน</string>
|
||||
<string name="permdesc_dataUsageWrite">อนุญาตให้แอปสามารถปรับปรุงเนื้อหาของฐานข้อมูลการใช้งาน</string>
|
||||
<string name="permlab_dataUsageRead">อ่านฐานข้อมูลการใช้งาน</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay açık hava moduna geçti.</string>
|
||||
<string name="permlab_perfAccess">performans yöneticisine erişim</string>
|
||||
<string name="permdesc_perfAccessDesc">Bir uygulamanın performans hizmetine erişimine izin verir. Normal uygulamalar için gerekli değildir.</string>
|
||||
<string name="permlab_weather_read">hava durumunu oku</string>
|
||||
<string name="permdesc_weather_read">Bir uygulamanın hava durumu sağlayıcısından içerik okumasına izin verir.</string>
|
||||
<string name="permlab_weather_write">hava durumu sağlayıcısını güncelleme</string>
|
||||
<string name="permdesc_weather_write">Bir uygulamanın hava durumu sağlayıcısının içeriğini güncellemesine izin verir.</string>
|
||||
<string name="permlab_weather_bind">hava durumu sağlayıcı hizmeti olarak bağla</string>
|
||||
<string name="permdesc_weather_bind">Bir uygulamanın hava durumu sağlayıcısı olarak tanımlanmasına izin verir.</string>
|
||||
<string name="permlab_weather_access_mgr">hava durumu servisine erişme</string>
|
||||
<string name="permdesc_weather_access_mgr">Bir uygulamanın sistemdeki hava durumu hizmetinin erişimine izin verir. Normal uygulamalar için gerekli değildir.</string>
|
||||
<string name="permlab_dataUsageWrite">veri kullanımı veritabanını değiştir</string>
|
||||
<string name="permdesc_dataUsageWrite">Bir uygulamanın veri kullanımı veribatanının içeriğini güncellemesine izin verir.</string>
|
||||
<string name="permlab_dataUsageRead">veri kullanımı veritabanını oku</string>
|
||||
|
||||
@@ -66,14 +66,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay змінено до режиму на вулиці.</string>
|
||||
<string name="permlab_perfAccess">доступ до менеджера продуктивності</string>
|
||||
<string name="permdesc_perfAccessDesc">Дозволяє додатку отримувати доступ до менеджера продуктивності. Цей дозвіл не потрібний звичайним додаткам.</string>
|
||||
<string name="permlab_weather_read">читати погоду</string>
|
||||
<string name="permdesc_weather_read">Дозволити додатку читати дані від провайдера погоди.</string>
|
||||
<string name="permlab_weather_write">оновлення провайдера погоди</string>
|
||||
<string name="permdesc_weather_write">Дозволяє додатку оновлювати дані провайдера погоди.</string>
|
||||
<string name="permlab_weather_bind">прив\'язати як провайдера погоди</string>
|
||||
<string name="permdesc_weather_bind">Дозволяє додатку бути службою провайдера погоди.</string>
|
||||
<string name="permlab_weather_access_mgr">доступ до служби погоди</string>
|
||||
<string name="permdesc_weather_access_mgr">Дозволити додатку доступ до служби погоди в системі. Це ніколи не потрібно для звичайних додатків.</string>
|
||||
<string name="permlab_dataUsageWrite">змінювати дані використання бази даних</string>
|
||||
<string name="permdesc_dataUsageWrite">Дозволяє додатку оновлювати вміст БД використання даних.</string>
|
||||
<string name="permlab_dataUsageRead">читати дані використання бази даних</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay đã đổi sang chế độ ngoài trời.</string>
|
||||
<string name="permlab_perfAccess">truy cập trình quản lý hiệu quả hoạt động</string>
|
||||
<string name="permdesc_perfAccessDesc">Cho phép một ứng dụng truy cập dịch vụ hiệu quả hoạt động. Ứng dụng bình thường không bao giờ cần quyền này.</string>
|
||||
<string name="permlab_weather_read">đọc thời tiết</string>
|
||||
<string name="permdesc_weather_read">Cho phép ứng dụng đọc nội dung từ nhà cung cấp thời tiết.</string>
|
||||
<string name="permlab_weather_write">cập nhật nhà cung cấp thời tiết</string>
|
||||
<string name="permdesc_weather_write">Cho phép ứng dụng cập nhật nội dung của nhà cung cấp thời tiết.</string>
|
||||
<string name="permlab_weather_bind">ràng buộc như là dịch vụ của nhà cung cấp thời tiết</string>
|
||||
<string name="permdesc_weather_bind">Cho phép ứng dụng được xác định như là dịch vụ của nhà cung cấp thời tiết.</string>
|
||||
<string name="permlab_weather_access_mgr">truy cập dịch vụ thời tiết</string>
|
||||
<string name="permdesc_weather_access_mgr">Cho phép ứng dụng truy cập dịch vụ thời tiết trong hệ thống. Ứng dụng bình thường không bao giờ cần sự cho phép này.</string>
|
||||
<string name="permlab_dataUsageWrite">sửa đổi cơ sở dữ liệu sử dụng dữ liệu</string>
|
||||
<string name="permdesc_dataUsageWrite">Cho phép ứng dụng cập nhật nội dung của cơ sở dữ liệu sử dụng dữ liệu.</string>
|
||||
<string name="permlab_dataUsageRead">đọc cơ sở dữ liệu sử dụng dữ liệu</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay 已修改为户外模式。</string>
|
||||
<string name="permlab_perfAccess">访问性能管理器</string>
|
||||
<string name="permdesc_perfAccessDesc">允许应用访问性能服务。普通应用不应需要此权限。</string>
|
||||
<string name="permlab_weather_read">读取天气</string>
|
||||
<string name="permdesc_weather_read">允许应用读取来自天气提供商的内容。</string>
|
||||
<string name="permlab_weather_write">更新天气提供商</string>
|
||||
<string name="permdesc_weather_write">允许应用更新来自天气提供商的内容。</string>
|
||||
<string name="permlab_weather_bind">绑定为天气提供商服务</string>
|
||||
<string name="permdesc_weather_bind">允许应用被认定为天气服务商服务。</string>
|
||||
<string name="permlab_weather_access_mgr">访问天气服务</string>
|
||||
<string name="permdesc_weather_access_mgr">允许应用在系统中访问天气服务。正常应用不应需要此权限。</string>
|
||||
<string name="permlab_dataUsageWrite">修改数据使用情况数据库</string>
|
||||
<string name="permdesc_dataUsageWrite">允许应用更新数据使用情况数据库。</string>
|
||||
<string name="permlab_dataUsageRead">读取数据使用情况数据库。</string>
|
||||
|
||||
@@ -72,14 +72,6 @@
|
||||
<string name="accessibility_quick_settings_live_display_changed_outdoor">LiveDisplay 已變更為戶外模式</string>
|
||||
<string name="permlab_perfAccess">存取效能管理員</string>
|
||||
<string name="permdesc_perfAccessDesc">允許應用程式存取效能服務 。一般應用程式不需使用。</string>
|
||||
<string name="permlab_weather_read">讀取天氣資料</string>
|
||||
<string name="permdesc_weather_read">允許應用程式從天氣資訊供應商讀取資料內容</string>
|
||||
<string name="permlab_weather_write">更新天氣</string>
|
||||
<string name="permdesc_weather_write">允許應用程式更新天氣資訊提供者的內容。</string>
|
||||
<string name="permlab_weather_bind">綁定為天氣資訊供應商服務</string>
|
||||
<string name="permdesc_weather_bind">允許應用程式辨識為天氣供應商服務。</string>
|
||||
<string name="permlab_weather_access_mgr">存取氣象服務</string>
|
||||
<string name="permdesc_weather_access_mgr">允許應用程式存取氣象服務 。一般應用程式不需使用。</string>
|
||||
<string name="permlab_dataUsageWrite">修改數據使用量資料庫</string>
|
||||
<string name="permdesc_dataUsageWrite">允許應用程式更新數據使用量資料庫內容。</string>
|
||||
<string name="permlab_dataUsageRead">讀取數據使用量資料庫</string>
|
||||
|
||||
@@ -102,16 +102,6 @@
|
||||
<!-- Performance manager permission description -->
|
||||
<string name="permdesc_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps.</string>
|
||||
|
||||
<!-- Weather Service strings -->
|
||||
<string name="permlab_weather_read">read weather</string>
|
||||
<string name="permdesc_weather_read">Allows an app to read content from the weather provider.</string>
|
||||
<string name="permlab_weather_write">update weather provider</string>
|
||||
<string name="permdesc_weather_write">Allows an app to update the content of the weather provider.</string>
|
||||
<string name="permlab_weather_bind">bind as a weather provider service</string>
|
||||
<string name="permdesc_weather_bind">Allows an app to be identified as a weather provider service.</string>
|
||||
<string name="permlab_weather_access_mgr">access weather service</string>
|
||||
<string name="permdesc_weather_access_mgr">Allows an app to access the weather service in the system. Should never be needed for normal apps.</string>
|
||||
|
||||
<!-- DataUsageProvider write permission title -->
|
||||
<string name="permlab_dataUsageWrite">modify data usage database</string>
|
||||
<!-- DataUsageProvider write permission description -->
|
||||
|
||||
@@ -93,9 +93,6 @@
|
||||
<!-- Default values for protected component managers -->
|
||||
<string name="def_protected_component_managers" translatable="false">com.android.settings|com.android.launcher3|org.lineageos.trebuchet|org.lineageos.lineageparts</string>
|
||||
|
||||
<!-- Default temperature unit (CELSIUS) -->
|
||||
<integer name="def_temperature_unit">2</integer>
|
||||
|
||||
<!-- Default enabled event based LLS components
|
||||
Contains a list of component names for enabled components, separated by '|'
|
||||
ex. com.example.mylls/com.example.mylls.LiveLockScreen|com.example.anotherLls/com.example.anotherLls.MyLls
|
||||
|
||||
@@ -234,20 +234,9 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
||||
}
|
||||
|
||||
if (upgradeVersion < 5) {
|
||||
if (mUserHandle == UserHandle.USER_OWNER) {
|
||||
db.beginTransaction();
|
||||
SQLiteStatement stmt = null;
|
||||
try {
|
||||
stmt = db.compileStatement("INSERT INTO global(name,value)"
|
||||
+ " VALUES(?,?);");
|
||||
loadIntegerSetting(stmt, LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||
R.integer.def_temperature_unit);
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
if (stmt != null) stmt.close();
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
/* Was set LineageSettings.Global.WEATHER_TEMPERATURE_UNIT
|
||||
* but this is no longer used
|
||||
*/
|
||||
upgradeVersion = 5;
|
||||
}
|
||||
|
||||
@@ -584,9 +573,6 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
||||
loadStringSetting(stmt,
|
||||
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
|
||||
R.string.def_power_notifications_ringtone);
|
||||
|
||||
loadIntegerSetting(stmt, LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||
R.integer.def_temperature_unit);
|
||||
} finally {
|
||||
if (stmt != null) stmt.close();
|
||||
}
|
||||
|
||||
@@ -98,9 +98,6 @@ public class LineageSettingsProviderDefaultsTest extends AndroidTestCase {
|
||||
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
|
||||
LineageSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
|
||||
"R.string.def_power_notifications_ringtone"));
|
||||
GLOBAL_SETTINGS_DEFAULTS.add(new Setting(
|
||||
LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||
"R.integer.def_temperature_unit"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -70,18 +70,6 @@ public final class LineageContextConstants {
|
||||
*/
|
||||
public static final String LINEAGE_ICON_CACHE_SERVICE = "lineageiconcache";
|
||||
|
||||
/**
|
||||
* Use with {@link android.content.Context#getSystemService} to retrieve a
|
||||
* {@link lineageos.weather.LineageWeatherManager} to manage the weather service
|
||||
* settings and request weather updates
|
||||
*
|
||||
* @see android.content.Context#getSystemService
|
||||
* @see lineageos.weather.LineageWeatherManager
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String LINEAGE_WEATHER_SERVICE = "lineageweather";
|
||||
|
||||
/**
|
||||
* Manages display color adjustments
|
||||
*
|
||||
@@ -143,14 +131,6 @@ public final class LineageContextConstants {
|
||||
@SdkConstant(SdkConstant.SdkConstantType.FEATURE)
|
||||
public static final String PERFORMANCE = "org.lineageos.performance";
|
||||
|
||||
/**
|
||||
* Feature for {@link PackageManager#getSystemAvailableFeatures} and
|
||||
* {@link PackageManager#hasSystemFeature}: The device includes the lineage weather weather
|
||||
* service utilized by the lineage sdk.
|
||||
*/
|
||||
@SdkConstant(SdkConstant.SdkConstantType.FEATURE)
|
||||
public static final String WEATHER_SERVICES = "org.lineageos.weather";
|
||||
|
||||
/**
|
||||
* Feature for {@link PackageManager#getSystemAvailableFeatures} and
|
||||
* {@link PackageManager#hasSystemFeature}: The device includes the LiveDisplay service
|
||||
|
||||
@@ -1555,16 +1555,6 @@ public final class LineageSettings {
|
||||
public static final Validator DOUBLE_TAP_SLEEP_GESTURE_VALIDATOR =
|
||||
sBooleanValidator;
|
||||
|
||||
/**
|
||||
* Boolean value on whether to show weather in the statusbar
|
||||
* 0 = 0ff, 1 = on
|
||||
*/
|
||||
public static final String STATUS_BAR_SHOW_WEATHER = "status_bar_show_weather";
|
||||
|
||||
/** @hide */
|
||||
public static final Validator STATUS_BAR_SHOW_WEATHER_VALIDATOR =
|
||||
sBooleanValidator;
|
||||
|
||||
/**
|
||||
* Show search bar in recents
|
||||
* 0 = Off, 1 = on
|
||||
@@ -2095,7 +2085,6 @@ public final class LineageSettings {
|
||||
LineageSettings.System.DISPLAY_COLOR_ADJUSTMENT,
|
||||
LineageSettings.System.LIVE_DISPLAY_HINTED,
|
||||
LineageSettings.System.DOUBLE_TAP_SLEEP_GESTURE,
|
||||
LineageSettings.System.STATUS_BAR_SHOW_WEATHER,
|
||||
LineageSettings.System.RECENTS_SHOW_SEARCH_BAR,
|
||||
LineageSettings.System.NAVBAR_LEFT_IN_LANDSCAPE,
|
||||
LineageSettings.System.T9_SEARCH_INPUT_LOCALE,
|
||||
@@ -2231,7 +2220,6 @@ public final class LineageSettings {
|
||||
VALIDATORS.put(LIVE_DISPLAY_HINTED, LIVE_DISPLAY_HINTED_VALIDATOR);
|
||||
VALIDATORS.put(TRUST_INTERFACE_HINTED, TRUST_INTERFACE_HINTED_VALIDATOR);
|
||||
VALIDATORS.put(DOUBLE_TAP_SLEEP_GESTURE, DOUBLE_TAP_SLEEP_GESTURE_VALIDATOR);
|
||||
VALIDATORS.put(STATUS_BAR_SHOW_WEATHER, STATUS_BAR_SHOW_WEATHER_VALIDATOR);
|
||||
VALIDATORS.put(RECENTS_SHOW_SEARCH_BAR, RECENTS_SHOW_SEARCH_BAR_VALIDATOR);
|
||||
VALIDATORS.put(NAVBAR_LEFT_IN_LANDSCAPE, NAVBAR_LEFT_IN_LANDSCAPE_VALIDATOR);
|
||||
VALIDATORS.put(T9_SEARCH_INPUT_LOCALE, T9_SEARCH_INPUT_LOCALE_VALIDATOR);
|
||||
@@ -2926,25 +2914,12 @@ public final class LineageSettings {
|
||||
*/
|
||||
public static final String VIBRATOR_INTENSITY = "vibrator_intensity";
|
||||
|
||||
/**
|
||||
* Current active & enabled Weather Provider Service
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final String WEATHER_PROVIDER_SERVICE = "weather_provider_service";
|
||||
|
||||
/**
|
||||
* Whether lock screen bluring is enabled on devices that support this feature
|
||||
* @hide
|
||||
*/
|
||||
public static final String LOCK_SCREEN_BLUR_ENABLED = "lock_screen_blur_enabled";
|
||||
|
||||
/**
|
||||
* Whether to display weather information on the lock screen
|
||||
* @hide
|
||||
*/
|
||||
public static final String LOCK_SCREEN_WEATHER_ENABLED = "lock_screen_weather_enabled";
|
||||
|
||||
/**
|
||||
* Network traffic indicator mode
|
||||
* 0 = Don't show network traffic indicator
|
||||
@@ -3553,14 +3528,6 @@ public final class LineageSettings {
|
||||
* @hide
|
||||
*/
|
||||
public static final String WIFI_AUTO_PRIORITIES_CONFIGURATION = "wifi_auto_priority";
|
||||
|
||||
/**
|
||||
* Global temperature unit in which the weather data will be reported
|
||||
* Valid values are:
|
||||
* <p>{@link lineageos.providers.WeatherContract.WeatherColumns.TempUnit#CELSIUS}</p>
|
||||
* <p>{@link lineageos.providers.WeatherContract.WeatherColumns.TempUnit#FAHRENHEIT}</p>
|
||||
*/
|
||||
public static final String WEATHER_TEMPERATURE_UNIT = "weather_temperature_unit";
|
||||
// endregion
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.providers;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
/**
|
||||
* The contract between the weather provider and applications.
|
||||
*/
|
||||
public class WeatherContract {
|
||||
|
||||
/**
|
||||
* The authority of the weather content provider
|
||||
*/
|
||||
public static final String AUTHORITY = "org.lineageos.weather";
|
||||
|
||||
/**
|
||||
* A content:// style uri to the authority for the weather provider
|
||||
*/
|
||||
public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
|
||||
|
||||
public static class WeatherColumns {
|
||||
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, "weather");
|
||||
|
||||
public static final Uri CURRENT_AND_FORECAST_WEATHER_URI
|
||||
= Uri.withAppendedPath(CONTENT_URI, "current_and_forecast");
|
||||
public static final Uri CURRENT_WEATHER_URI
|
||||
= Uri.withAppendedPath(CONTENT_URI, "current");
|
||||
public static final Uri FORECAST_WEATHER_URI
|
||||
= Uri.withAppendedPath(CONTENT_URI, "forecast");
|
||||
|
||||
/**
|
||||
* The city name
|
||||
* <P>Type: TEXT</P>
|
||||
*/
|
||||
public static final String CURRENT_CITY = "city";
|
||||
|
||||
/**
|
||||
* A Valid {@link WeatherCode}
|
||||
* <P>Type: INTEGER</P>
|
||||
*/
|
||||
public static final String CURRENT_CONDITION_CODE = "condition_code";
|
||||
|
||||
|
||||
/**
|
||||
* A localized string mapped to the current weather condition code. Note that, if no
|
||||
* locale is found, the string will be in english
|
||||
* <P>Type: TEXT</P>
|
||||
*/
|
||||
public static final String CURRENT_CONDITION = "condition";
|
||||
|
||||
/**
|
||||
* The current weather temperature
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String CURRENT_TEMPERATURE = "temperature";
|
||||
|
||||
/**
|
||||
* The unit in which current temperature is reported
|
||||
* <P>Type: INTEGER</P>
|
||||
* Can be one of the following:
|
||||
* <ul>
|
||||
* <li>{@link TempUnit#CELSIUS}</li>
|
||||
* <li>{@link TempUnit#FAHRENHEIT}</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final String CURRENT_TEMPERATURE_UNIT = "temperature_unit";
|
||||
|
||||
/**
|
||||
* The current weather humidity
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String CURRENT_HUMIDITY = "humidity";
|
||||
|
||||
/**
|
||||
* The current wind direction (in degrees)
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String CURRENT_WIND_DIRECTION = "wind_direction";
|
||||
|
||||
/**
|
||||
* The current wind speed
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String CURRENT_WIND_SPEED = "wind_speed";
|
||||
|
||||
/**
|
||||
* The unit in which the wind speed is reported
|
||||
* <P>Type: INTEGER</P>
|
||||
* Can be one of the following:
|
||||
* <ul>
|
||||
* <li>{@link WindSpeedUnit#KPH}</li>
|
||||
* <li>{@link WindSpeedUnit#MPH}</li>
|
||||
* </ul>
|
||||
*/
|
||||
public static final String CURRENT_WIND_SPEED_UNIT = "wind_speed_unit";
|
||||
|
||||
/**
|
||||
* The timestamp when this weather was reported
|
||||
* <P>Type: LONG</P>
|
||||
*/
|
||||
public static final String CURRENT_TIMESTAMP = "timestamp";
|
||||
|
||||
/**
|
||||
* Today's high temperature.
|
||||
* <p>Type: DOUBLE</p>
|
||||
*/
|
||||
public static final String TODAYS_HIGH_TEMPERATURE = "todays_high";
|
||||
|
||||
/**
|
||||
* Today's low temperature.
|
||||
* <p>Type: DOUBLE</p>
|
||||
*/
|
||||
public static final String TODAYS_LOW_TEMPERATURE = "todays_low";
|
||||
|
||||
/**
|
||||
* The forecasted low temperature
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String FORECAST_LOW = "forecast_low";
|
||||
|
||||
/**
|
||||
* The forecasted high temperature
|
||||
* <P>Type: DOUBLE</P>
|
||||
*/
|
||||
public static final String FORECAST_HIGH = "forecast_high";
|
||||
|
||||
/**
|
||||
* A localized string mapped to the forecasted weather condition code. Note that, if no
|
||||
* locale is found, the string will be in english
|
||||
* <P>Type: TEXT</P>
|
||||
*/
|
||||
public static final String FORECAST_CONDITION = "forecast_condition";
|
||||
|
||||
/**
|
||||
* The code identifying the forecasted weather condition.
|
||||
* @see #CURRENT_CONDITION_CODE
|
||||
*/
|
||||
public static final String FORECAST_CONDITION_CODE = "forecast_condition_code";
|
||||
|
||||
/**
|
||||
* Temperature units
|
||||
*/
|
||||
public static final class TempUnit {
|
||||
private TempUnit() {}
|
||||
public final static int CELSIUS = 1;
|
||||
public final static int FAHRENHEIT = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wind speed units
|
||||
*/
|
||||
public static final class WindSpeedUnit {
|
||||
private WindSpeedUnit() {}
|
||||
/**
|
||||
* Kilometers per hour
|
||||
*/
|
||||
public final static int KPH = 1;
|
||||
|
||||
/**
|
||||
* Miles per hour
|
||||
*/
|
||||
public final static int MPH = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Weather condition codes
|
||||
*/
|
||||
public static final class WeatherCode {
|
||||
private WeatherCode() {}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final static int WEATHER_CODE_MIN = 0;
|
||||
|
||||
public final static int TORNADO = 0;
|
||||
public final static int TROPICAL_STORM = 1;
|
||||
public final static int HURRICANE = 2;
|
||||
public final static int SEVERE_THUNDERSTORMS = 3;
|
||||
public final static int THUNDERSTORMS = 4;
|
||||
public final static int MIXED_RAIN_AND_SNOW = 5;
|
||||
public final static int MIXED_RAIN_AND_SLEET = 6;
|
||||
public final static int MIXED_SNOW_AND_SLEET = 7;
|
||||
public final static int FREEZING_DRIZZLE = 8;
|
||||
public final static int DRIZZLE = 9;
|
||||
public final static int FREEZING_RAIN = 10;
|
||||
public final static int SHOWERS = 11;
|
||||
public final static int SNOW_FLURRIES = 12;
|
||||
public final static int LIGHT_SNOW_SHOWERS = 13;
|
||||
public final static int BLOWING_SNOW = 14;
|
||||
public final static int SNOW = 15;
|
||||
public final static int HAIL = 16;
|
||||
public final static int SLEET = 17;
|
||||
public final static int DUST = 18;
|
||||
public final static int FOGGY = 19;
|
||||
public final static int HAZE = 20;
|
||||
public final static int SMOKY = 21;
|
||||
public final static int BLUSTERY = 22;
|
||||
public final static int WINDY = 23;
|
||||
public final static int COLD = 24;
|
||||
public final static int CLOUDY = 25;
|
||||
public final static int MOSTLY_CLOUDY_NIGHT = 26;
|
||||
public final static int MOSTLY_CLOUDY_DAY = 27;
|
||||
public final static int PARTLY_CLOUDY_NIGHT = 28;
|
||||
public final static int PARTLY_CLOUDY_DAY = 29;
|
||||
public final static int CLEAR_NIGHT = 30;
|
||||
public final static int SUNNY = 31;
|
||||
public final static int FAIR_NIGHT = 32;
|
||||
public final static int FAIR_DAY = 33;
|
||||
public final static int MIXED_RAIN_AND_HAIL = 34;
|
||||
public final static int HOT = 35;
|
||||
public final static int ISOLATED_THUNDERSTORMS = 36;
|
||||
public final static int SCATTERED_THUNDERSTORMS = 37;
|
||||
public final static int SCATTERED_SHOWERS = 38;
|
||||
public final static int HEAVY_SNOW = 39;
|
||||
public final static int SCATTERED_SNOW_SHOWERS = 40;
|
||||
public final static int PARTLY_CLOUDY = 41;
|
||||
public final static int THUNDERSHOWER = 42;
|
||||
public final static int SNOW_SHOWERS = 43;
|
||||
public final static int ISOLATED_THUNDERSHOWERS = 44;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final static int WEATHER_CODE_MAX = 44;
|
||||
|
||||
public final static int NOT_AVAILABLE = 3200;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import lineageos.weather.IWeatherServiceProviderChangeListener;
|
||||
import lineageos.weather.RequestInfo;
|
||||
|
||||
/** @hide */
|
||||
interface ILineageWeatherManager {
|
||||
oneway void updateWeather(in RequestInfo info);
|
||||
oneway void lookupCity(in RequestInfo info);
|
||||
oneway void registerWeatherServiceProviderChangeListener(
|
||||
in IWeatherServiceProviderChangeListener listener);
|
||||
oneway void unregisterWeatherServiceProviderChangeListener(
|
||||
in IWeatherServiceProviderChangeListener listener);
|
||||
String getActiveWeatherServiceProviderLabel();
|
||||
oneway void cancelRequest(int requestId);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import lineageos.weather.RequestInfo;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** @hide */
|
||||
oneway interface IRequestInfoListener {
|
||||
void onWeatherRequestCompleted(in RequestInfo requestInfo, int status,
|
||||
in WeatherInfo weatherInfo);
|
||||
void onLookupCityRequestCompleted(in RequestInfo requestInfo, int status,
|
||||
in List<WeatherLocation> weatherLocation);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
/** @hide */
|
||||
oneway interface IWeatherServiceProviderChangeListener {
|
||||
void onWeatherServiceProviderChanged(String providerLabel);
|
||||
}
|
||||
@@ -1,411 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import lineageos.app.LineageContextConstants;
|
||||
import lineageos.providers.LineageSettings;
|
||||
import lineageos.providers.WeatherContract;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Provides access to the weather services in the device.
|
||||
*/
|
||||
public class LineageWeatherManager {
|
||||
|
||||
private static ILineageWeatherManager sWeatherManagerService;
|
||||
private static LineageWeatherManager sInstance;
|
||||
private Context mContext;
|
||||
private Map<RequestInfo,WeatherUpdateRequestListener> mWeatherUpdateRequestListeners
|
||||
= Collections.synchronizedMap(new HashMap<RequestInfo,WeatherUpdateRequestListener>());
|
||||
private Map<RequestInfo,LookupCityRequestListener> mLookupNameRequestListeners
|
||||
= Collections.synchronizedMap(new HashMap<RequestInfo,LookupCityRequestListener>());
|
||||
private Handler mHandler;
|
||||
private Set<WeatherServiceProviderChangeListener> mProviderChangedListeners = new ArraySet<>();
|
||||
|
||||
private static final String TAG = LineageWeatherManager.class.getSimpleName();
|
||||
|
||||
|
||||
/**
|
||||
* The different request statuses
|
||||
*/
|
||||
public static final class RequestStatus {
|
||||
|
||||
private RequestStatus() {}
|
||||
|
||||
/**
|
||||
* Request successfully completed
|
||||
*/
|
||||
public static final int COMPLETED = 1;
|
||||
/**
|
||||
* An error occurred while trying to honor the request
|
||||
*/
|
||||
public static final int FAILED = -1;
|
||||
/**
|
||||
* The request can't be processed at this time
|
||||
*/
|
||||
public static final int SUBMITTED_TOO_SOON = -2;
|
||||
/**
|
||||
* Another request is already in progress
|
||||
*/
|
||||
public static final int ALREADY_IN_PROGRESS = -3;
|
||||
/**
|
||||
* No match found for the query
|
||||
*/
|
||||
public static final int NO_MATCH_FOUND = -4;
|
||||
}
|
||||
|
||||
private LineageWeatherManager(Context context) {
|
||||
Context appContext = context.getApplicationContext();
|
||||
mContext = (appContext != null) ? appContext : context;
|
||||
sWeatherManagerService = getService();
|
||||
|
||||
if (context.getPackageManager().hasSystemFeature(
|
||||
LineageContextConstants.Features.WEATHER_SERVICES) && (sWeatherManagerService == null)) {
|
||||
Log.wtf(TAG, "Unable to bind the LineageWeatherManagerService");
|
||||
}
|
||||
mHandler = new Handler(appContext.getMainLooper());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or creates an instance of the {@link lineageos.weather.LineageWeatherManager}
|
||||
* @param context
|
||||
* @return {@link LineageWeatherManager}
|
||||
*/
|
||||
public static LineageWeatherManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new LineageWeatherManager(context);
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public static ILineageWeatherManager getService() {
|
||||
if (sWeatherManagerService != null) {
|
||||
return sWeatherManagerService;
|
||||
}
|
||||
IBinder binder = ServiceManager.getService(LineageContextConstants.LINEAGE_WEATHER_SERVICE);
|
||||
if (binder != null) {
|
||||
sWeatherManagerService = ILineageWeatherManager.Stub.asInterface(binder);
|
||||
return sWeatherManagerService;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the weather service to request the latest available weather information for
|
||||
* the supplied {@link android.location.Location} location.
|
||||
*
|
||||
* @param location The location you want to get the latest weather data from.
|
||||
* @param listener {@link WeatherUpdateRequestListener} To be notified once the active weather
|
||||
* service provider has finished
|
||||
* processing your request
|
||||
* @return An integer that identifies the request submitted to the weather service
|
||||
* Note that this method might return -1 if an error occurred while trying to submit
|
||||
* the request.
|
||||
*/
|
||||
public int requestWeatherUpdate(@NonNull Location location,
|
||||
@NonNull WeatherUpdateRequestListener listener) {
|
||||
if (sWeatherManagerService == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
int tempUnit = LineageSettings.Global.getInt(mContext.getContentResolver(),
|
||||
LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||
WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT);
|
||||
|
||||
RequestInfo info = new RequestInfo
|
||||
.Builder(mRequestInfoListener)
|
||||
.setLocation(location)
|
||||
.setTemperatureUnit(tempUnit)
|
||||
.build();
|
||||
if (listener != null) mWeatherUpdateRequestListeners.put(info, listener);
|
||||
sWeatherManagerService.updateWeather(info);
|
||||
return info.hashCode();
|
||||
} catch (RemoteException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the weather service to request the latest weather information for the provided
|
||||
* WeatherLocation. This is the preferred method for requesting a weather update.
|
||||
*
|
||||
* @param weatherLocation A {@link lineageos.weather.WeatherLocation} that was previously
|
||||
* obtained by calling
|
||||
* {@link #lookupCity(String, LookupCityRequestListener)}
|
||||
* @param listener {@link WeatherUpdateRequestListener} To be notified once the active weather
|
||||
* service provider has finished
|
||||
* processing your request
|
||||
* @return An integer that identifies the request submitted to the weather service.
|
||||
* Note that this method might return -1 if an error occurred while trying to submit
|
||||
* the request.
|
||||
*/
|
||||
public int requestWeatherUpdate(@NonNull WeatherLocation weatherLocation,
|
||||
@NonNull WeatherUpdateRequestListener listener) {
|
||||
if (sWeatherManagerService == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
int tempUnit = LineageSettings.Global.getInt(mContext.getContentResolver(),
|
||||
LineageSettings.Global.WEATHER_TEMPERATURE_UNIT,
|
||||
WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT);
|
||||
|
||||
RequestInfo info = new RequestInfo
|
||||
.Builder(mRequestInfoListener)
|
||||
.setWeatherLocation(weatherLocation)
|
||||
.setTemperatureUnit(tempUnit)
|
||||
.build();
|
||||
if (listener != null) mWeatherUpdateRequestListeners.put(info, listener);
|
||||
sWeatherManagerService.updateWeather(info);
|
||||
return info.hashCode();
|
||||
} catch (RemoteException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the active weather provider service to lookup the supplied city name.
|
||||
*
|
||||
* @param city The city name
|
||||
* @param listener {@link LookupCityRequestListener} To be notified once the request has been
|
||||
* completed. Upon success, a list of
|
||||
* {@link lineageos.weather.WeatherLocation}
|
||||
* will be provided
|
||||
* @return An integer that identifies the request submitted to the weather service.
|
||||
* Note that this method might return -1 if an error occurred while trying to submit
|
||||
* the request.
|
||||
*/
|
||||
public int lookupCity(@NonNull String city, @NonNull LookupCityRequestListener listener) {
|
||||
if (sWeatherManagerService == null) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
RequestInfo info = new RequestInfo
|
||||
.Builder(mRequestInfoListener)
|
||||
.setCityName(city)
|
||||
.build();
|
||||
if (listener != null) mLookupNameRequestListeners.put(info, listener);
|
||||
sWeatherManagerService.lookupCity(info);
|
||||
return info.hashCode();
|
||||
} catch (RemoteException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels a request that was previously submitted to the weather service.
|
||||
* @param requestId The ID that you received when the request was submitted
|
||||
*/
|
||||
public void cancelRequest(int requestId) {
|
||||
if (sWeatherManagerService == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
sWeatherManagerService.cancelRequest(requestId);
|
||||
}catch (RemoteException e){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a {@link WeatherServiceProviderChangeListener} to be notified when a new weather
|
||||
* service provider becomes active.
|
||||
* @param listener {@link WeatherServiceProviderChangeListener} to register
|
||||
*/
|
||||
public void registerWeatherServiceProviderChangeListener(
|
||||
@NonNull WeatherServiceProviderChangeListener listener) {
|
||||
if (sWeatherManagerService == null) return;
|
||||
|
||||
synchronized (mProviderChangedListeners) {
|
||||
if (mProviderChangedListeners.contains(listener)) {
|
||||
throw new IllegalArgumentException("Listener already registered");
|
||||
}
|
||||
if (mProviderChangedListeners.size() == 0) {
|
||||
try {
|
||||
sWeatherManagerService.registerWeatherServiceProviderChangeListener(
|
||||
mProviderChangeListener);
|
||||
} catch (RemoteException e){
|
||||
}
|
||||
}
|
||||
mProviderChangedListeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a listener
|
||||
* @param listener A previously registered {@link WeatherServiceProviderChangeListener}
|
||||
*/
|
||||
public void unregisterWeatherServiceProviderChangeListener(
|
||||
@NonNull WeatherServiceProviderChangeListener listener) {
|
||||
if (sWeatherManagerService == null) return;
|
||||
|
||||
synchronized (mProviderChangedListeners) {
|
||||
if (!mProviderChangedListeners.contains(listener)) {
|
||||
throw new IllegalArgumentException("Listener was never registered");
|
||||
}
|
||||
mProviderChangedListeners.remove(listener);
|
||||
if (mProviderChangedListeners.size() == 0) {
|
||||
try {
|
||||
sWeatherManagerService.unregisterWeatherServiceProviderChangeListener(
|
||||
mProviderChangeListener);
|
||||
} catch(RemoteException e){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service's label as declared by the active weather service provider in its manifest
|
||||
* @return the service's label
|
||||
*/
|
||||
public String getActiveWeatherServiceProviderLabel() {
|
||||
if (sWeatherManagerService == null) return null;
|
||||
|
||||
try {
|
||||
return sWeatherManagerService.getActiveWeatherServiceProviderLabel();
|
||||
} catch(RemoteException e){
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private final IWeatherServiceProviderChangeListener mProviderChangeListener =
|
||||
new IWeatherServiceProviderChangeListener.Stub() {
|
||||
@Override
|
||||
public void onWeatherServiceProviderChanged(final String providerName) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (mProviderChangedListeners) {
|
||||
List<WeatherServiceProviderChangeListener> deadListeners
|
||||
= new ArrayList<>();
|
||||
for (WeatherServiceProviderChangeListener listener
|
||||
: mProviderChangedListeners) {
|
||||
try {
|
||||
listener.onWeatherServiceProviderChanged(providerName);
|
||||
} catch (Throwable e) {
|
||||
deadListeners.add(listener);
|
||||
}
|
||||
}
|
||||
if (deadListeners.size() > 0) {
|
||||
for (WeatherServiceProviderChangeListener listener : deadListeners) {
|
||||
mProviderChangedListeners.remove(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private final IRequestInfoListener mRequestInfoListener = new IRequestInfoListener.Stub() {
|
||||
|
||||
@Override
|
||||
public void onWeatherRequestCompleted(final RequestInfo requestInfo, final int status,
|
||||
final WeatherInfo weatherInfo) {
|
||||
final WeatherUpdateRequestListener listener
|
||||
= mWeatherUpdateRequestListeners.remove(requestInfo);
|
||||
if (listener != null) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listener.onWeatherRequestCompleted(status, weatherInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLookupCityRequestCompleted(RequestInfo requestInfo, final int status,
|
||||
final List<WeatherLocation> weatherLocations) {
|
||||
|
||||
final LookupCityRequestListener listener
|
||||
= mLookupNameRequestListeners.remove(requestInfo);
|
||||
if (listener != null) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
listener.onLookupCityRequestCompleted(status, weatherLocations);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface used to receive notifications upon completion of a weather update request
|
||||
*/
|
||||
public interface WeatherUpdateRequestListener {
|
||||
/**
|
||||
* This method will be called when the weather service provider has finished processing the
|
||||
* request
|
||||
*
|
||||
* @param status See {@link RequestStatus}
|
||||
*
|
||||
* @param weatherInfo A fully populated {@link WeatherInfo} if state is
|
||||
* {@link RequestStatus#COMPLETED}, null otherwise
|
||||
*/
|
||||
void onWeatherRequestCompleted(int status, WeatherInfo weatherInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to receive notifications upon completion of a request to lookup a city name
|
||||
*/
|
||||
public interface LookupCityRequestListener {
|
||||
/**
|
||||
* This method will be called when the weather service provider has finished processing the
|
||||
* request.
|
||||
*
|
||||
* @param status See {@link RequestStatus}
|
||||
*
|
||||
* @param locations A list of {@link WeatherLocation} if the status is
|
||||
* {@link RequestStatus#COMPLETED}, null otherwise
|
||||
*/
|
||||
void onLookupCityRequestCompleted(int status, List<WeatherLocation> locations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to be notified when the user changes the weather service provider
|
||||
*/
|
||||
public interface WeatherServiceProviderChangeListener {
|
||||
/**
|
||||
* This method will be called when a new weather service provider becomes active in the
|
||||
* system. The parameter can be null when
|
||||
* <p>The user removed the active weather service provider from the system </p>
|
||||
* <p>The active weather provider was disabled.</p>
|
||||
*
|
||||
* @param providerLabel The label as declared on the weather service provider manifest
|
||||
*/
|
||||
void onWeatherServiceProviderChanged(String providerLabel);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
parcelable RequestInfo;
|
||||
@@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import lineageos.os.Build;
|
||||
import lineageos.os.Concierge;
|
||||
import lineageos.os.Concierge.ParcelInfo;
|
||||
import lineageos.providers.WeatherContract;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* This class holds the information of a request submitted to the active weather provider service
|
||||
*/
|
||||
public final class RequestInfo implements Parcelable {
|
||||
|
||||
private Location mLocation;
|
||||
private String mCityName;
|
||||
private WeatherLocation mWeatherLocation;
|
||||
private int mRequestType;
|
||||
private IRequestInfoListener mListener;
|
||||
private int mTempUnit;
|
||||
private String mKey;
|
||||
private boolean mIsQueryOnly;
|
||||
|
||||
/**
|
||||
* A request to update the weather data using a geographical {@link android.location.Location}
|
||||
*/
|
||||
public static final int TYPE_WEATHER_BY_GEO_LOCATION_REQ = 1;
|
||||
/**
|
||||
* A request to update the weather data using a {@link WeatherLocation}
|
||||
*/
|
||||
public static final int TYPE_WEATHER_BY_WEATHER_LOCATION_REQ = 2;
|
||||
|
||||
/**
|
||||
* A request to look up a city name
|
||||
*/
|
||||
public static final int TYPE_LOOKUP_CITY_NAME_REQ = 3;
|
||||
|
||||
private RequestInfo() {}
|
||||
|
||||
/* package */ static class Builder {
|
||||
private Location mLocation;
|
||||
private String mCityName;
|
||||
private WeatherLocation mWeatherLocation;
|
||||
private int mRequestType;
|
||||
private IRequestInfoListener mListener;
|
||||
private int mTempUnit = WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT;
|
||||
private boolean mIsQueryOnly = false;
|
||||
|
||||
public Builder(IRequestInfoListener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the city name and identifies this request as a {@link #TYPE_LOOKUP_CITY_NAME_REQ}
|
||||
* request. If set, will null out the location and weather location. Attempting to set
|
||||
* a null city name will get you an IllegalArgumentException
|
||||
*/
|
||||
public Builder setCityName(String cityName) {
|
||||
if (cityName == null) {
|
||||
throw new IllegalArgumentException("City name can't be null");
|
||||
}
|
||||
this.mCityName = cityName;
|
||||
this.mRequestType = TYPE_LOOKUP_CITY_NAME_REQ;
|
||||
this.mLocation = null;
|
||||
this.mWeatherLocation = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Location and identifies this request as a
|
||||
* {@link #TYPE_WEATHER_BY_GEO_LOCATION_REQ}. If set, will null out the city name and
|
||||
* weather location. Attempting to set a null location will get you an
|
||||
* IllegalArgumentException
|
||||
*/
|
||||
public Builder setLocation(Location location) {
|
||||
if (location == null) {
|
||||
throw new IllegalArgumentException("Location can't be null");
|
||||
}
|
||||
this.mLocation = new Location(location);
|
||||
this.mCityName = null;
|
||||
this.mWeatherLocation = null;
|
||||
this.mRequestType = TYPE_WEATHER_BY_GEO_LOCATION_REQ;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the weather location and identifies this request as a
|
||||
* {@link #TYPE_WEATHER_BY_WEATHER_LOCATION_REQ}. If set, will null out the location and
|
||||
* city name. Attempting to set a null weather location will get you an
|
||||
* IllegalArgumentException
|
||||
*/
|
||||
public Builder setWeatherLocation(WeatherLocation weatherLocation) {
|
||||
if (weatherLocation == null) {
|
||||
throw new IllegalArgumentException("WeatherLocation can't be null");
|
||||
}
|
||||
this.mWeatherLocation = weatherLocation;
|
||||
this.mLocation = null;
|
||||
this.mCityName = null;
|
||||
this.mRequestType = TYPE_WEATHER_BY_WEATHER_LOCATION_REQ;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the unit in which the temperature will be reported if the request is honored.
|
||||
* Valid values are:
|
||||
* <ul>
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.TempUnit#CELSIUS}
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.TempUnit#FAHRENHEIT}
|
||||
* </ul>
|
||||
* Any other value will generate an IllegalArgumentException. If the temperature unit is not
|
||||
* set, the default will be degrees Fahrenheit
|
||||
* @param unit A valid temperature unit
|
||||
*/
|
||||
public Builder setTemperatureUnit(int unit) {
|
||||
if (!isValidTempUnit(unit)) {
|
||||
throw new IllegalArgumentException("Invalid temperature unit");
|
||||
}
|
||||
this.mTempUnit = unit;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is a weather request, marks the request as a query only, meaning that the
|
||||
* content provider won't be updated after the active weather service has finished
|
||||
* processing the request.
|
||||
*/
|
||||
public Builder queryOnly() {
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
this.mIsQueryOnly = true;
|
||||
break;
|
||||
default:
|
||||
this.mIsQueryOnly = false;
|
||||
break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine all of the options that have been set and return a new {@link RequestInfo} object
|
||||
* @return {@link RequestInfo}
|
||||
*/
|
||||
public RequestInfo build() {
|
||||
RequestInfo info = new RequestInfo();
|
||||
info.mListener = this.mListener;
|
||||
info.mRequestType = this.mRequestType;
|
||||
info.mCityName = this.mCityName;
|
||||
info.mWeatherLocation = this.mWeatherLocation;
|
||||
info.mLocation = this.mLocation;
|
||||
info.mTempUnit = this.mTempUnit;
|
||||
info.mIsQueryOnly = this.mIsQueryOnly;
|
||||
info.mKey = UUID.randomUUID().toString();
|
||||
return info;
|
||||
}
|
||||
|
||||
private boolean isValidTempUnit(int unit) {
|
||||
switch (unit) {
|
||||
case WeatherContract.WeatherColumns.TempUnit.CELSIUS:
|
||||
case WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private RequestInfo(Parcel parcel) {
|
||||
// Read parcelable version via the Concierge
|
||||
ParcelInfo parcelInfo = Concierge.receiveParcel(parcel);
|
||||
int parcelableVersion = parcelInfo.getParcelVersion();
|
||||
|
||||
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) {
|
||||
mKey = parcel.readString();
|
||||
mRequestType = parcel.readInt();
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
mLocation = Location.CREATOR.createFromParcel(parcel);
|
||||
mTempUnit = parcel.readInt();
|
||||
break;
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
mWeatherLocation = WeatherLocation.CREATOR.createFromParcel(parcel);
|
||||
mTempUnit = parcel.readInt();
|
||||
break;
|
||||
case TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
mCityName = parcel.readString();
|
||||
break;
|
||||
}
|
||||
mIsQueryOnly = (parcel.readInt() == 1);
|
||||
mListener = IRequestInfoListener.Stub.asInterface(parcel.readStrongBinder());
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The request type
|
||||
*/
|
||||
public int getRequestType() {
|
||||
return mRequestType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link android.location.Location} if this is a request by location, null
|
||||
* otherwise
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return new Location(mLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link lineageos.weather.WeatherLocation} if this is a request by weather
|
||||
* location, null otherwise
|
||||
*/
|
||||
public WeatherLocation getWeatherLocation() {
|
||||
return mWeatherLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public IRequestInfoListener getRequestListener() {
|
||||
return mListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the city name if this is a lookup request, null otherwise
|
||||
*/
|
||||
public String getCityName() {
|
||||
return mCityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the temperature unit if this is a weather request, -1 otherwise
|
||||
*/
|
||||
public int getTemperatureUnit() {
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
return mTempUnit;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if this is a weather request, whether the request will update the content provider.
|
||||
* False for other kind of requests
|
||||
* @hide
|
||||
*/
|
||||
public boolean isQueryOnlyWeatherRequest() {
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
return mIsQueryOnly;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<RequestInfo> CREATOR = new Creator<RequestInfo>() {
|
||||
@Override
|
||||
public RequestInfo createFromParcel(Parcel in) {
|
||||
return new RequestInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestInfo[] newArray(int size) {
|
||||
return new RequestInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
// Tell the concierge to prepare the parcel
|
||||
ParcelInfo parcelInfo = Concierge.prepareParcel(dest);
|
||||
|
||||
// ==== ELDERBERRY =====
|
||||
dest.writeString(mKey);
|
||||
dest.writeInt(mRequestType);
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
mLocation.writeToParcel(dest, 0);
|
||||
dest.writeInt(mTempUnit);
|
||||
break;
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
mWeatherLocation.writeToParcel(dest, 0);
|
||||
dest.writeInt(mTempUnit);
|
||||
break;
|
||||
case TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
dest.writeString(mCityName);
|
||||
break;
|
||||
}
|
||||
dest.writeInt(mIsQueryOnly == true ? 1 : 0);
|
||||
dest.writeStrongBinder(mListener.asBinder());
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("{ Request for ");
|
||||
switch (mRequestType) {
|
||||
case TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
builder.append("Location: ").append(mLocation);
|
||||
builder.append(" Temp Unit: ");
|
||||
if (mTempUnit == WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT) {
|
||||
builder.append("Fahrenheit");
|
||||
} else {
|
||||
builder.append(" Celsius");
|
||||
}
|
||||
break;
|
||||
case TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
builder.append("WeatherLocation: ").append(mWeatherLocation);
|
||||
builder.append(" Temp Unit: ");
|
||||
if (mTempUnit == WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT) {
|
||||
builder.append("Fahrenheit");
|
||||
} else {
|
||||
builder.append(" Celsius");
|
||||
}
|
||||
break;
|
||||
case TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
builder.append("Lookup City: ").append(mCityName);
|
||||
break;
|
||||
}
|
||||
return builder.append(" }").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mKey != null) ? mKey.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (getClass() == obj.getClass()) {
|
||||
RequestInfo info = (RequestInfo) obj;
|
||||
return (TextUtils.equals(mKey, info.mKey));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanongenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
parcelable WeatherInfo;
|
||||
@@ -1,640 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanongenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
import lineageos.os.Build;
|
||||
import lineageos.os.Concierge;
|
||||
import lineageos.os.Concierge.ParcelInfo;
|
||||
import lineageos.providers.WeatherContract;
|
||||
import lineageos.weatherservice.ServiceRequest;
|
||||
import lineageos.weatherservice.ServiceRequestResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* This class represents the weather information that a
|
||||
* {@link lineageos.weatherservice.WeatherProviderService} will use to update the weather content
|
||||
* provider. A weather provider service will be called by the system to process an update
|
||||
* request at any time. If the service successfully processes the request, then the weather provider
|
||||
* service is responsible of calling
|
||||
* {@link ServiceRequest#complete(ServiceRequestResult)} to notify the
|
||||
* system that the request was completed and that the weather content provider should be updated
|
||||
* with the supplied weather information.
|
||||
*/
|
||||
public final class WeatherInfo implements Parcelable {
|
||||
|
||||
private String mCity;
|
||||
private int mConditionCode;
|
||||
private double mTemperature;
|
||||
private int mTempUnit;
|
||||
private double mTodaysHighTemp;
|
||||
private double mTodaysLowTemp;
|
||||
private double mHumidity;
|
||||
private double mWindSpeed;
|
||||
private double mWindDirection;
|
||||
private int mWindSpeedUnit;
|
||||
private long mTimestamp;
|
||||
private List<DayForecast> mForecastList;
|
||||
private String mKey;
|
||||
|
||||
private WeatherInfo() {}
|
||||
|
||||
/**
|
||||
* Builder class for {@link WeatherInfo}
|
||||
*/
|
||||
public static class Builder {
|
||||
private String mCity;
|
||||
private int mConditionCode = WeatherContract.WeatherColumns.WeatherCode.NOT_AVAILABLE;
|
||||
private double mTemperature;
|
||||
private int mTempUnit;
|
||||
private double mTodaysHighTemp = Double.NaN;
|
||||
private double mTodaysLowTemp = Double.NaN;
|
||||
private double mHumidity = Double.NaN;
|
||||
private double mWindSpeed = Double.NaN;
|
||||
private double mWindDirection = Double.NaN;
|
||||
private int mWindSpeedUnit = WeatherContract.WeatherColumns.WindSpeedUnit.MPH;
|
||||
private long mTimestamp = -1;
|
||||
private List<DayForecast> mForecastList = new ArrayList<>(0);
|
||||
|
||||
/**
|
||||
* @param cityName A valid city name. Attempting to pass null will get you an
|
||||
* IllegalArgumentException
|
||||
* @param temperature A valid temperature value. Attempting pass an invalid double value,
|
||||
* will get you an IllegalArgumentException
|
||||
* @param tempUnit A valid temperature unit value. See
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.TempUnit} for
|
||||
* valid values. Attempting to pass an invalid temperature unit will get you
|
||||
* an IllegalArgumentException
|
||||
*/
|
||||
public Builder(@NonNull String cityName, double temperature, int tempUnit) {
|
||||
if (cityName == null) {
|
||||
throw new IllegalArgumentException("City name can't be null");
|
||||
}
|
||||
if (Double.isNaN(temperature)) {
|
||||
throw new IllegalArgumentException("Invalid temperature");
|
||||
}
|
||||
if (!isValidTempUnit(tempUnit)) {
|
||||
throw new IllegalArgumentException("Invalid temperature unit");
|
||||
}
|
||||
this.mCity = cityName;
|
||||
this.mTemperature = temperature;
|
||||
this.mTempUnit = tempUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeStamp A timestamp indicating when this data was generated. If timestamps is
|
||||
* not set, then the builder will set it to the time of object creation
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setTimestamp(long timeStamp) {
|
||||
mTimestamp = timeStamp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param humidity The weather humidity. Attempting to pass an invalid double value will get
|
||||
* you an IllegalArgumentException
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setHumidity(double humidity) {
|
||||
if (Double.isNaN(humidity)) {
|
||||
throw new IllegalArgumentException("Invalid humidity value");
|
||||
}
|
||||
|
||||
mHumidity = humidity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windSpeed The wind speed. Attempting to pass an invalid double value will get you
|
||||
* an IllegalArgumentException
|
||||
* @param windDirection The wind direction. Attempting to pass an invalid double value will
|
||||
* get you an IllegalArgumentException
|
||||
* @param windSpeedUnit A valid wind speed direction unit. See
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.WindSpeedUnit}
|
||||
* for valid values. Attempting to pass an invalid speed unit will get
|
||||
* you an IllegalArgumentException
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setWind(double windSpeed, double windDirection, int windSpeedUnit) {
|
||||
if (Double.isNaN(windSpeed)) {
|
||||
throw new IllegalArgumentException("Invalid wind speed value");
|
||||
}
|
||||
if (Double.isNaN(windDirection)) {
|
||||
throw new IllegalArgumentException("Invalid wind direction value");
|
||||
}
|
||||
if (!isValidWindSpeedUnit(windSpeedUnit)) {
|
||||
throw new IllegalArgumentException("Invalid speed unit");
|
||||
}
|
||||
mWindSpeed = windSpeed;
|
||||
mWindSpeedUnit = windSpeedUnit;
|
||||
mWindDirection = windDirection;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conditionCode A valid weather condition code. See
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.WeatherCode}
|
||||
* for valid codes. Attempting to pass an invalid code will get you an
|
||||
* IllegalArgumentException.
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setWeatherCondition(int conditionCode) {
|
||||
if (!isValidWeatherCode(conditionCode)) {
|
||||
throw new IllegalArgumentException("Invalid weather condition code");
|
||||
}
|
||||
mConditionCode = conditionCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param forecasts A valid array list of {@link DayForecast} objects. Attempting to pass
|
||||
* null will get you an IllegalArgumentException'
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setForecast(@NonNull List<DayForecast> forecasts) {
|
||||
if (forecasts == null) {
|
||||
throw new IllegalArgumentException("Forecast list can't be null");
|
||||
}
|
||||
mForecastList = forecasts;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param todaysHigh Today's high temperature. Attempting to pass an invalid double value
|
||||
* will get you an IllegalArgumentException
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setTodaysHigh(double todaysHigh) {
|
||||
if (Double.isNaN(todaysHigh)) {
|
||||
throw new IllegalArgumentException("Invalid temperature value");
|
||||
}
|
||||
mTodaysHighTemp = todaysHigh;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param todaysLow Today's low temperature. Attempting to pass an invalid double value will
|
||||
* get you an IllegalArgumentException
|
||||
* @return
|
||||
*/
|
||||
public Builder setTodaysLow(double todaysLow) {
|
||||
if (Double.isNaN(todaysLow)) {
|
||||
throw new IllegalArgumentException("Invalid temperature value");
|
||||
}
|
||||
mTodaysLowTemp = todaysLow;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine all of the options that have been set and return a new {@link WeatherInfo} object
|
||||
* @return {@link WeatherInfo}
|
||||
*/
|
||||
public WeatherInfo build() {
|
||||
WeatherInfo info = new WeatherInfo();
|
||||
info.mCity = this.mCity;
|
||||
info.mConditionCode = this.mConditionCode;
|
||||
info.mTemperature = this.mTemperature;
|
||||
info.mTempUnit = this.mTempUnit;
|
||||
info.mHumidity = this.mHumidity;
|
||||
info.mWindSpeed = this.mWindSpeed;
|
||||
info.mWindDirection = this.mWindDirection;
|
||||
info.mWindSpeedUnit = this.mWindSpeedUnit;
|
||||
info.mTimestamp = this.mTimestamp == -1 ? System.currentTimeMillis() : this.mTimestamp;
|
||||
info.mForecastList = this.mForecastList;
|
||||
info.mTodaysHighTemp = this.mTodaysHighTemp;
|
||||
info.mTodaysLowTemp = this.mTodaysLowTemp;
|
||||
info.mKey = UUID.randomUUID().toString();
|
||||
return info;
|
||||
}
|
||||
|
||||
private boolean isValidTempUnit(int unit) {
|
||||
switch (unit) {
|
||||
case WeatherContract.WeatherColumns.TempUnit.CELSIUS:
|
||||
case WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isValidWindSpeedUnit(int unit) {
|
||||
switch (unit) {
|
||||
case WeatherContract.WeatherColumns.WindSpeedUnit.KPH:
|
||||
case WeatherContract.WeatherColumns.WindSpeedUnit.MPH:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean isValidWeatherCode(int code) {
|
||||
if (code < WeatherContract.WeatherColumns.WeatherCode.WEATHER_CODE_MIN
|
||||
|| code > WeatherContract.WeatherColumns.WeatherCode.WEATHER_CODE_MAX) {
|
||||
if (code != WeatherContract.WeatherColumns.WeatherCode.NOT_AVAILABLE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return city name
|
||||
*/
|
||||
public String getCity() {
|
||||
return mCity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An implementation specific weather condition code
|
||||
*/
|
||||
public int getConditionCode() {
|
||||
return mConditionCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return humidity
|
||||
*/
|
||||
public double getHumidity() {
|
||||
return mHumidity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return time stamp when the request was processed
|
||||
*/
|
||||
public long getTimestamp() {
|
||||
return mTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return wind direction (degrees)
|
||||
*/
|
||||
public double getWindDirection() {
|
||||
return mWindDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return wind speed
|
||||
*/
|
||||
public double getWindSpeed() {
|
||||
return mWindSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return wind speed unit
|
||||
*/
|
||||
public int getWindSpeedUnit() {
|
||||
return mWindSpeedUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return current temperature
|
||||
*/
|
||||
public double getTemperature() {
|
||||
return mTemperature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return temperature unit
|
||||
*/
|
||||
public int getTemperatureUnit() {
|
||||
return mTempUnit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return today's high temperature
|
||||
*/
|
||||
public double getTodaysHigh() {
|
||||
return mTodaysHighTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return today's low temperature
|
||||
*/
|
||||
public double getTodaysLow() {
|
||||
return mTodaysLowTemp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return List of {@link lineageos.weather.WeatherInfo.DayForecast}. This list will contain
|
||||
* the forecast weather for the upcoming days. If you want to know today's high and low
|
||||
* temperatures, use {@link WeatherInfo#getTodaysHigh()} and {@link WeatherInfo#getTodaysLow()}
|
||||
*/
|
||||
public List<DayForecast> getForecasts() {
|
||||
return new ArrayList<>(mForecastList);
|
||||
}
|
||||
|
||||
private WeatherInfo(Parcel parcel) {
|
||||
// Read parcelable version via the Concierge
|
||||
ParcelInfo parcelInfo = Concierge.receiveParcel(parcel);
|
||||
int parcelableVersion = parcelInfo.getParcelVersion();
|
||||
|
||||
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) {
|
||||
mKey = parcel.readString();
|
||||
mCity = parcel.readString();
|
||||
mConditionCode = parcel.readInt();
|
||||
mTemperature = parcel.readDouble();
|
||||
mTempUnit = parcel.readInt();
|
||||
mHumidity = parcel.readDouble();
|
||||
mWindSpeed = parcel.readDouble();
|
||||
mWindDirection = parcel.readDouble();
|
||||
mWindSpeedUnit = parcel.readInt();
|
||||
mTodaysHighTemp = parcel.readDouble();
|
||||
mTodaysLowTemp = parcel.readDouble();
|
||||
mTimestamp = parcel.readLong();
|
||||
int forecastListSize = parcel.readInt();
|
||||
mForecastList = new ArrayList<>();
|
||||
while (forecastListSize > 0) {
|
||||
mForecastList.add(DayForecast.CREATOR.createFromParcel(parcel));
|
||||
forecastListSize--;
|
||||
}
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
// Tell the concierge to prepare the parcel
|
||||
ParcelInfo parcelInfo = Concierge.prepareParcel(dest);
|
||||
|
||||
// ==== ELDERBERRY =====
|
||||
dest.writeString(mKey);
|
||||
dest.writeString(mCity);
|
||||
dest.writeInt(mConditionCode);
|
||||
dest.writeDouble(mTemperature);
|
||||
dest.writeInt(mTempUnit);
|
||||
dest.writeDouble(mHumidity);
|
||||
dest.writeDouble(mWindSpeed);
|
||||
dest.writeDouble(mWindDirection);
|
||||
dest.writeInt(mWindSpeedUnit);
|
||||
dest.writeDouble(mTodaysHighTemp);
|
||||
dest.writeDouble(mTodaysLowTemp);
|
||||
dest.writeLong(mTimestamp);
|
||||
dest.writeInt(mForecastList.size());
|
||||
for (DayForecast dayForecast : mForecastList) {
|
||||
dayForecast.writeToParcel(dest, 0);
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<WeatherInfo> CREATOR =
|
||||
new Parcelable.Creator<WeatherInfo>() {
|
||||
|
||||
@Override
|
||||
public WeatherInfo createFromParcel(Parcel source) {
|
||||
return new WeatherInfo(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeatherInfo[] newArray(int size) {
|
||||
return new WeatherInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents the weather forecast for a given day. Do not add low and high
|
||||
* temperatures for the current day in this list. Use
|
||||
* {@link WeatherInfo.Builder#setTodaysHigh(double)} and
|
||||
* {@link WeatherInfo.Builder#setTodaysLow(double)} instead.
|
||||
*/
|
||||
public static class DayForecast implements Parcelable{
|
||||
double mLow;
|
||||
double mHigh;
|
||||
int mConditionCode;
|
||||
String mKey;
|
||||
|
||||
private DayForecast() {}
|
||||
|
||||
/**
|
||||
* Builder class for {@link DayForecast}
|
||||
*/
|
||||
public static class Builder {
|
||||
double mLow = Double.NaN;
|
||||
double mHigh = Double.NaN;
|
||||
int mConditionCode;
|
||||
|
||||
/**
|
||||
* @param conditionCode A valid weather condition code. See
|
||||
* {@link lineageos.providers.WeatherContract.WeatherColumns.WeatherCode} for valid
|
||||
* values. Attempting to pass an invalid code will get you an
|
||||
* IllegalArgumentException
|
||||
*/
|
||||
public Builder(int conditionCode) {
|
||||
if (!isValidWeatherCode(conditionCode)) {
|
||||
throw new IllegalArgumentException("Invalid weather condition code");
|
||||
}
|
||||
mConditionCode = conditionCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param high Forecast high temperature for this day. Attempting to pass an invalid
|
||||
* double value will get you an IllegalArgumentException
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setHigh(double high) {
|
||||
if (Double.isNaN(high)) {
|
||||
throw new IllegalArgumentException("Invalid high forecast temperature");
|
||||
}
|
||||
mHigh = high;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param low Forecast low temperate for this day. Attempting to pass an invalid double
|
||||
* value will get you an IllegalArgumentException
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setLow(double low) {
|
||||
if (Double.isNaN(low)) {
|
||||
throw new IllegalArgumentException("Invalid low forecast temperature");
|
||||
}
|
||||
mLow = low;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Combine all of the options that have been set and return a new {@link DayForecast}
|
||||
* object
|
||||
* @return {@link DayForecast}
|
||||
*/
|
||||
public DayForecast build() {
|
||||
DayForecast forecast = new DayForecast();
|
||||
forecast.mLow = this.mLow;
|
||||
forecast.mHigh = this.mHigh;
|
||||
forecast.mConditionCode = this.mConditionCode;
|
||||
forecast.mKey = UUID.randomUUID().toString();
|
||||
return forecast;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return forecasted low temperature
|
||||
*/
|
||||
public double getLow() {
|
||||
return mLow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return not what you think. Returns the forecasted high temperature
|
||||
*/
|
||||
public double getHigh() {
|
||||
return mHigh;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return forecasted weather condition code. Implementation specific
|
||||
*/
|
||||
public int getConditionCode() {
|
||||
return mConditionCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
// Tell the concierge to prepare the parcel
|
||||
ParcelInfo parcelInfo = Concierge.prepareParcel(dest);
|
||||
|
||||
// ==== ELDERBERRY =====
|
||||
dest.writeString(mKey);
|
||||
dest.writeDouble(mLow);
|
||||
dest.writeDouble(mHigh);
|
||||
dest.writeInt(mConditionCode);
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<DayForecast> CREATOR =
|
||||
new Parcelable.Creator<DayForecast>() {
|
||||
@Override
|
||||
public DayForecast createFromParcel(Parcel source) {
|
||||
return new DayForecast(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DayForecast[] newArray(int size) {
|
||||
return new DayForecast[size];
|
||||
}
|
||||
};
|
||||
|
||||
private DayForecast(Parcel parcel) {
|
||||
// Read parcelable version via the Concierge
|
||||
ParcelInfo parcelInfo = Concierge.receiveParcel(parcel);
|
||||
int parcelableVersion = parcelInfo.getParcelVersion();
|
||||
|
||||
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) {
|
||||
mKey = parcel.readString();
|
||||
mLow = parcel.readDouble();
|
||||
mHigh = parcel.readDouble();
|
||||
mConditionCode = parcel.readInt();
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()
|
||||
.append("{Low temp: ").append(mLow)
|
||||
.append(" High temp: ").append(mHigh)
|
||||
.append(" Condition code: ").append(mConditionCode)
|
||||
.append("}").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mKey != null) ? mKey.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (getClass() == obj.getClass()) {
|
||||
DayForecast forecast = (DayForecast) obj;
|
||||
return (TextUtils.equals(mKey, forecast.mKey));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder()
|
||||
.append(" City Name: ").append(mCity)
|
||||
.append(" Condition Code: ").append(mConditionCode)
|
||||
.append(" Temperature: ").append(mTemperature)
|
||||
.append(" Temperature Unit: ").append(mTempUnit)
|
||||
.append(" Humidity: ").append(mHumidity)
|
||||
.append(" Wind speed: ").append(mWindSpeed)
|
||||
.append(" Wind direction: ").append(mWindDirection)
|
||||
.append(" Wind Speed Unit: ").append(mWindSpeedUnit)
|
||||
.append(" Today's high temp: ").append(mTodaysHighTemp)
|
||||
.append(" Today's low temp: ").append(mTodaysLowTemp)
|
||||
.append(" Timestamp: ").append(mTimestamp).append(" Forecasts: [");
|
||||
for (DayForecast dayForecast : mForecastList) {
|
||||
builder.append(dayForecast.toString());
|
||||
}
|
||||
return builder.append("]}").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mKey != null) ? mKey.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (getClass() == obj.getClass()) {
|
||||
WeatherInfo info = (WeatherInfo) obj;
|
||||
return (TextUtils.equals(mKey, info.mKey));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
parcelable WeatherLocation;
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import lineageos.os.Build;
|
||||
import lineageos.os.Concierge;
|
||||
import lineageos.os.Concierge.ParcelInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A class representing a geographical location that a weather service provider can use to
|
||||
* get weather data from. Each service provider will potentially populate objects of this class
|
||||
* with different content, so make sure you don't preserve the values when a service provider
|
||||
* is changed
|
||||
*/
|
||||
public final class WeatherLocation implements Parcelable{
|
||||
private String mCityId;
|
||||
private String mCity;
|
||||
private String mState;
|
||||
private String mPostal;
|
||||
private String mCountryId;
|
||||
private String mCountry;
|
||||
private String mKey;
|
||||
|
||||
private WeatherLocation() {}
|
||||
|
||||
/**
|
||||
* Builder class for {@link WeatherLocation}
|
||||
*/
|
||||
public static class Builder {
|
||||
String mCityId = "";
|
||||
String mCity = "";
|
||||
String mState = "";
|
||||
String mPostal = "";
|
||||
String mCountryId = "";
|
||||
String mCountry = "";
|
||||
|
||||
/**
|
||||
* @param cityId An identifier for the city (for example WOEID - Where On Earth IDentifier)
|
||||
* @param cityName The name of the city
|
||||
*/
|
||||
public Builder(String cityId, String cityName) {
|
||||
if (cityId == null || cityName == null) {
|
||||
throw new IllegalArgumentException("Illegal to set city id AND city to null");
|
||||
}
|
||||
this.mCityId = cityId;
|
||||
this.mCity = cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cityName The name of the city
|
||||
*/
|
||||
public Builder(String cityName) {
|
||||
if (cityName == null) {
|
||||
throw new IllegalArgumentException("City name can't be null");
|
||||
}
|
||||
this.mCity = cityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param countryId An identifier for the country (for example ISO alpha-2, ISO alpha-3,
|
||||
* ISO 3166-1 numeric-3, etc)
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setCountryId(String countryId) {
|
||||
if (countryId == null) {
|
||||
throw new IllegalArgumentException("Country ID can't be null");
|
||||
}
|
||||
this.mCountryId = countryId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param country The country name
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setCountry(String country) {
|
||||
if (country == null) {
|
||||
throw new IllegalArgumentException("Country can't be null");
|
||||
}
|
||||
this.mCountry = country;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param postalCode The postal/ZIP code
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setPostalCode(String postalCode) {
|
||||
if (postalCode == null) {
|
||||
throw new IllegalArgumentException("Postal code/ZIP can't be null");
|
||||
}
|
||||
this.mPostal = postalCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param state The state or territory where the city is located
|
||||
* @return The {@link Builder} instance
|
||||
*/
|
||||
public Builder setState(String state) {
|
||||
if (state == null) {
|
||||
throw new IllegalArgumentException("State can't be null");
|
||||
}
|
||||
this.mState = state;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine all of the options that have been set and return a new {@link WeatherLocation}
|
||||
* object
|
||||
* @return {@link WeatherLocation}
|
||||
*/
|
||||
public WeatherLocation build() {
|
||||
WeatherLocation weatherLocation = new WeatherLocation();
|
||||
weatherLocation.mCityId = this.mCityId;
|
||||
weatherLocation.mCity = this.mCity;
|
||||
weatherLocation.mState = this.mState;
|
||||
weatherLocation.mPostal = this.mPostal;
|
||||
weatherLocation.mCountryId = this.mCountryId;
|
||||
weatherLocation.mCountry = this.mCountry;
|
||||
weatherLocation.mKey = UUID.randomUUID().toString();
|
||||
return weatherLocation;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The city ID. This method will return an empty string if the city ID was not set
|
||||
*/
|
||||
public String getCityId() {
|
||||
return mCityId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The city name. This method will return an empty string if the city name was not set
|
||||
*/
|
||||
public String getCity() {
|
||||
return mCity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The state name. This method will return an empty string if the state was not set
|
||||
*/
|
||||
public String getState() {
|
||||
return mState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The postal/ZIP code. This method will return an empty string if the postal/ZIP code
|
||||
* was not set
|
||||
*/
|
||||
public String getPostalCode() {
|
||||
return mPostal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The country ID. This method will return an empty string if the country ID was not set
|
||||
*/
|
||||
public String getCountryId() {
|
||||
return mCountryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The country name. This method will return an empty string if the country ID was not
|
||||
* set
|
||||
*/
|
||||
public String getCountry() {
|
||||
return mCountry;
|
||||
}
|
||||
|
||||
private WeatherLocation(Parcel in) {
|
||||
// Read parcelable version via the Concierge
|
||||
ParcelInfo parcelInfo = Concierge.receiveParcel(in);
|
||||
int parcelableVersion = parcelInfo.getParcelVersion();
|
||||
|
||||
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) {
|
||||
mKey = in.readString();
|
||||
mCityId = in.readString();
|
||||
mCity = in.readString();
|
||||
mState = in.readString();
|
||||
mPostal = in.readString();
|
||||
mCountryId = in.readString();
|
||||
mCountry = in.readString();
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
public static final Creator<WeatherLocation> CREATOR = new Creator<WeatherLocation>() {
|
||||
@Override
|
||||
public WeatherLocation createFromParcel(Parcel in) {
|
||||
return new WeatherLocation(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeatherLocation[] newArray(int size) {
|
||||
return new WeatherLocation[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
// Tell the concierge to prepare the parcel
|
||||
ParcelInfo parcelInfo = Concierge.prepareParcel(dest);
|
||||
|
||||
// ==== ELDERBERRY =====
|
||||
dest.writeString(mKey);
|
||||
dest.writeString(mCityId);
|
||||
dest.writeString(mCity);
|
||||
dest.writeString(mState);
|
||||
dest.writeString(mPostal);
|
||||
dest.writeString(mCountryId);
|
||||
dest.writeString(mCountry);
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new StringBuilder()
|
||||
.append("{ City ID: ").append(mCityId)
|
||||
.append(" City: ").append(mCity)
|
||||
.append(" State: ").append(mState)
|
||||
.append(" Postal/ZIP Code: ").append(mPostal)
|
||||
.append(" Country Id: ").append(mCountryId)
|
||||
.append(" Country: ").append(mCountry).append("}")
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mKey != null) ? mKey.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (getClass() == obj.getClass()) {
|
||||
WeatherLocation location = (WeatherLocation) obj;
|
||||
return (TextUtils.equals(mKey, location.mKey));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weather.util;
|
||||
|
||||
|
||||
import lineageos.providers.WeatherContract;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* Helper class to perform operations and formatting of weather data
|
||||
*/
|
||||
public class WeatherUtils {
|
||||
|
||||
/**
|
||||
* Converts a temperature expressed in degrees Celsius to degrees Fahrenheit
|
||||
* @param celsius temperature in Celsius
|
||||
* @return the temperature in degrees Fahrenheit
|
||||
*/
|
||||
public static double celsiusToFahrenheit(double celsius) {
|
||||
return ((celsius * (9d/5d)) + 32d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a temperature expressed in degrees Fahrenheit to degrees Celsius
|
||||
* @param fahrenheit temperature in Fahrenheit
|
||||
* @return the temperature in degrees Celsius
|
||||
*/
|
||||
public static double fahrenheitToCelsius(double fahrenheit) {
|
||||
return ((fahrenheit - 32d) * (5d/9d));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the temperature and unit supplied. The temperature value
|
||||
* will be half-even rounded.
|
||||
* @param temperature the temperature value
|
||||
* @param tempUnit A valid {@link WeatherContract.WeatherColumns.TempUnit}
|
||||
* @return A string with the format XX°F or XX°C (where XX is the temperature)
|
||||
* depending on the temperature unit that was provided or null if an invalid unit is supplied
|
||||
*/
|
||||
public static String formatTemperature(double temperature, int tempUnit) {
|
||||
if (!isValidTempUnit(tempUnit)) return null;
|
||||
if (Double.isNaN(temperature)) return "-";
|
||||
|
||||
DecimalFormat noDigitsFormat = new DecimalFormat("0");
|
||||
String noDigitsTemp = noDigitsFormat.format(temperature);
|
||||
if (noDigitsTemp.equals("-0")) {
|
||||
noDigitsTemp = "0";
|
||||
}
|
||||
|
||||
StringBuilder formatted = new StringBuilder()
|
||||
.append(noDigitsTemp).append("\u00b0");
|
||||
if (tempUnit == WeatherContract.WeatherColumns.TempUnit.CELSIUS) {
|
||||
formatted.append("C");
|
||||
} else if (tempUnit == WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT) {
|
||||
formatted.append("F");
|
||||
}
|
||||
return formatted.toString();
|
||||
}
|
||||
|
||||
private static boolean isValidTempUnit(int unit) {
|
||||
switch (unit) {
|
||||
case WeatherContract.WeatherColumns.TempUnit.CELSIUS:
|
||||
case WeatherContract.WeatherColumns.TempUnit.FAHRENHEIT:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
import lineageos.weatherservice.IWeatherProviderServiceClient;
|
||||
import lineageos.weather.RequestInfo;
|
||||
|
||||
/** @hide */
|
||||
oneway interface IWeatherProviderService {
|
||||
void processWeatherUpdateRequest(in RequestInfo request);
|
||||
void processCityNameLookupRequest(in RequestInfo request);
|
||||
void setServiceClient(in IWeatherProviderServiceClient client);
|
||||
void cancelOngoingRequests();
|
||||
void cancelRequest(int requestId);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
import lineageos.weather.RequestInfo;
|
||||
import lineageos.weatherservice.ServiceRequestResult;
|
||||
|
||||
/** @hide */
|
||||
oneway interface IWeatherProviderServiceClient {
|
||||
void setServiceRequestState(in RequestInfo requestInfo, in ServiceRequestResult result,
|
||||
int state);
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.RemoteException;
|
||||
import lineageos.weather.LineageWeatherManager;
|
||||
import lineageos.weather.RequestInfo;
|
||||
|
||||
/**
|
||||
* This class represents a request submitted by the system to the active weather provider service
|
||||
*/
|
||||
public final class ServiceRequest {
|
||||
|
||||
private final RequestInfo mInfo;
|
||||
private final IWeatherProviderServiceClient mClient;
|
||||
|
||||
private enum Status {
|
||||
IN_PROGRESS, COMPLETED, CANCELLED, FAILED, REJECTED
|
||||
}
|
||||
private Status mStatus;
|
||||
|
||||
/* package */ ServiceRequest(RequestInfo info, IWeatherProviderServiceClient client) {
|
||||
mInfo = info;
|
||||
mClient = client;
|
||||
mStatus = Status.IN_PROGRESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the request information
|
||||
* @return {@link lineageos.weather.RequestInfo}
|
||||
*/
|
||||
public RequestInfo getRequestInfo() {
|
||||
return mInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be called once the request has been completed
|
||||
*/
|
||||
public void complete(@NonNull ServiceRequestResult result) {
|
||||
synchronized (this) {
|
||||
if (mStatus.equals(Status.IN_PROGRESS)) {
|
||||
try {
|
||||
final int requestType = mInfo.getRequestType();
|
||||
switch (requestType) {
|
||||
case RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
if (result.getWeatherInfo() == null) {
|
||||
throw new IllegalStateException("The service request result doesn't"
|
||||
+ " contain a valid WeatherInfo object");
|
||||
}
|
||||
mClient.setServiceRequestState(mInfo, result,
|
||||
LineageWeatherManager.RequestStatus.COMPLETED);
|
||||
break;
|
||||
case RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
if (result.getLocationLookupList() == null
|
||||
|| result.getLocationLookupList().size() <= 0) {
|
||||
//In case the user decided to mark this request as completed with
|
||||
//null or empty list. It's not necessarily a failure
|
||||
mClient.setServiceRequestState(mInfo, null,
|
||||
LineageWeatherManager.RequestStatus.NO_MATCH_FOUND);
|
||||
} else {
|
||||
mClient.setServiceRequestState(mInfo, result,
|
||||
LineageWeatherManager.RequestStatus.COMPLETED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mStatus = Status.COMPLETED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be called if the service failed to process the request
|
||||
* (no internet connection, time out, etc.)
|
||||
*/
|
||||
public void fail() {
|
||||
synchronized (this) {
|
||||
if (mStatus.equals(Status.IN_PROGRESS)) {
|
||||
try {
|
||||
final int requestType = mInfo.getRequestType();
|
||||
switch (requestType) {
|
||||
case RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
case RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
mClient.setServiceRequestState(mInfo, null,
|
||||
LineageWeatherManager.RequestStatus.FAILED);
|
||||
break;
|
||||
case RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
mClient.setServiceRequestState(mInfo, null,
|
||||
LineageWeatherManager.RequestStatus.FAILED);
|
||||
break;
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
mStatus = Status.FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be called if the service decides not to honor the request. Note this
|
||||
* method will accept only the following values.
|
||||
* <ul>
|
||||
* <li>{@link lineageos.weather.LineageWeatherManager.RequestStatus#SUBMITTED_TOO_SOON}</li>
|
||||
* <li>{@link lineageos.weather.LineageWeatherManager.RequestStatus#ALREADY_IN_PROGRESS}</li>
|
||||
* </ul>
|
||||
* Attempting to pass any other value will get you an IllegalArgumentException
|
||||
* @param status
|
||||
*/
|
||||
public void reject(int status) {
|
||||
synchronized (this) {
|
||||
if (mStatus.equals(Status.IN_PROGRESS)) {
|
||||
switch (status) {
|
||||
case LineageWeatherManager.RequestStatus.ALREADY_IN_PROGRESS:
|
||||
case LineageWeatherManager.RequestStatus.SUBMITTED_TOO_SOON:
|
||||
try {
|
||||
mClient.setServiceRequestState(mInfo, null, status);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Can't reject with status " + status);
|
||||
}
|
||||
mStatus = Status.REJECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the WeatherProviderService base class to notify we don't want this request anymore.
|
||||
* The service implementing the WeatherProviderService will be notified of this action
|
||||
* via onRequestCancelled()
|
||||
* @hide
|
||||
*/
|
||||
public void cancel() {
|
||||
synchronized (this) {
|
||||
mStatus = Status.CANCELLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
parcelable ServiceRequestResult;
|
||||
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import lineageos.os.Build;
|
||||
import lineageos.os.Concierge;
|
||||
import lineageos.os.Concierge.ParcelInfo;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Use this class to build a request result.
|
||||
*/
|
||||
public final class ServiceRequestResult implements Parcelable {
|
||||
|
||||
private WeatherInfo mWeatherInfo;
|
||||
private List<WeatherLocation> mLocationLookupList;
|
||||
private String mKey;
|
||||
|
||||
private ServiceRequestResult() {}
|
||||
|
||||
private ServiceRequestResult(Parcel in) {
|
||||
// Read parcelable version via the Concierge
|
||||
ParcelInfo parcelInfo = Concierge.receiveParcel(in);
|
||||
int parcelableVersion = parcelInfo.getParcelVersion();
|
||||
|
||||
if (parcelableVersion >= Build.LINEAGE_VERSION_CODES.ELDERBERRY) {
|
||||
mKey = in.readString();
|
||||
int hasWeatherInfo = in.readInt();
|
||||
if (hasWeatherInfo == 1) {
|
||||
mWeatherInfo = WeatherInfo.CREATOR.createFromParcel(in);
|
||||
}
|
||||
int hasLocationLookupList = in.readInt();
|
||||
if (hasLocationLookupList == 1) {
|
||||
mLocationLookupList = new ArrayList<>();
|
||||
int listSize = in.readInt();
|
||||
while (listSize > 0) {
|
||||
mLocationLookupList.add(WeatherLocation.CREATOR.createFromParcel(in));
|
||||
listSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
public static final Creator<ServiceRequestResult> CREATOR
|
||||
= new Creator<ServiceRequestResult>() {
|
||||
@Override
|
||||
public ServiceRequestResult createFromParcel(Parcel in) {
|
||||
return new ServiceRequestResult(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceRequestResult[] newArray(int size) {
|
||||
return new ServiceRequestResult[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
// Tell the concierge to prepare the parcel
|
||||
ParcelInfo parcelInfo = Concierge.prepareParcel(dest);
|
||||
|
||||
// ==== ELDERBERRY =====
|
||||
dest.writeString(mKey);
|
||||
if (mWeatherInfo != null) {
|
||||
dest.writeInt(1);
|
||||
mWeatherInfo.writeToParcel(dest, 0);
|
||||
} else {
|
||||
dest.writeInt(0);
|
||||
}
|
||||
if (mLocationLookupList != null) {
|
||||
dest.writeInt(1);
|
||||
dest.writeInt(mLocationLookupList.size());
|
||||
for (WeatherLocation lookup : mLocationLookupList) {
|
||||
lookup.writeToParcel(dest, 0);
|
||||
}
|
||||
} else {
|
||||
dest.writeInt(0);
|
||||
}
|
||||
|
||||
// Complete parcel info for the concierge
|
||||
parcelInfo.complete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder class for {@link ServiceRequestResult}
|
||||
*/
|
||||
public static class Builder {
|
||||
private WeatherInfo mWeatherInfo;
|
||||
private List<WeatherLocation> mLocationLookupList;
|
||||
public Builder() {
|
||||
this.mWeatherInfo = null;
|
||||
this.mLocationLookupList = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param weatherInfo The WeatherInfo object holding the data that will be used to update
|
||||
* the weather content provider
|
||||
*/
|
||||
public Builder(@NonNull WeatherInfo weatherInfo) {
|
||||
if (weatherInfo == null) {
|
||||
throw new IllegalArgumentException("WeatherInfo can't be null");
|
||||
}
|
||||
|
||||
mWeatherInfo = weatherInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param locations The list of WeatherLocation objects. The list should not be null
|
||||
*/
|
||||
public Builder(@NonNull List<WeatherLocation> locations) {
|
||||
if (locations == null) {
|
||||
throw new IllegalArgumentException("Weather location list can't be null");
|
||||
}
|
||||
mLocationLookupList = locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link ServiceRequestResult} with the arguments
|
||||
* supplied to this builder
|
||||
* @return {@link ServiceRequestResult}
|
||||
*/
|
||||
public ServiceRequestResult build() {
|
||||
ServiceRequestResult result = new ServiceRequestResult();
|
||||
result.mWeatherInfo = this.mWeatherInfo;
|
||||
result.mLocationLookupList = this.mLocationLookupList;
|
||||
result.mKey = UUID.randomUUID().toString();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The WeatherInfo object supplied by the weather provider service
|
||||
*/
|
||||
public WeatherInfo getWeatherInfo() {
|
||||
return mWeatherInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of WeatherLocation objects supplied by the weather provider service
|
||||
*/
|
||||
public List<WeatherLocation> getLocationLookupList() {
|
||||
return new ArrayList<>(mLocationLookupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((mKey != null) ? mKey.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
if (getClass() == obj.getClass()) {
|
||||
ServiceRequestResult request = (ServiceRequestResult) obj;
|
||||
return (TextUtils.equals(mKey, request.mKey));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package lineageos.weatherservice;
|
||||
|
||||
import android.annotation.SdkConstant;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import lineageos.weather.RequestInfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* This is the base class for implementing a weather provider service. A weather provider service
|
||||
* can handle weather update requests and update the weather content provider data by processing
|
||||
* a {@link ServiceRequest}
|
||||
*
|
||||
* A weather provider service is declared as any other service in an AndroidManifest.xml but it must
|
||||
* also specify that in handles the {@link android.content.Intent} with action
|
||||
* {@link #SERVICE_INTERFACE lineageos.weatherservice.WeatherProviderService}. Failure to declare
|
||||
* this intent will cause the system to ignore the weather provider service. Additionally, a
|
||||
* weather provider service must request the
|
||||
* {@link lineageos.platform.Manifest.permission#BIND_WEATHER_PROVIDER_SERVICE} permission to
|
||||
* ensure that only the system can bind to it. Failure to request this permission will cause the
|
||||
* system to ignore this weather provider service. Following is an example declaration:
|
||||
*
|
||||
* <pre>
|
||||
* <service android:name=".MyWeatherProviderService"
|
||||
* android:permission="lineageos.permission.BIND_WEATHER_PROVIDER_SERVICE">
|
||||
* <intent-filter>
|
||||
* <action android:name="lineageos.weatherservice.WeatherProviderService" />
|
||||
* <intent-filter>
|
||||
* . . .
|
||||
* </service>
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public abstract class WeatherProviderService extends Service {
|
||||
|
||||
private Handler mHandler;
|
||||
private IWeatherProviderServiceClient mClient;
|
||||
private Set<ServiceRequest> mWeakRequestsSet
|
||||
= Collections.newSetFromMap(new WeakHashMap<ServiceRequest, Boolean>());
|
||||
|
||||
/**
|
||||
* The {@link android.content.Intent} action that must be declared as handled by a service in
|
||||
* its manifest for the system to recognize it as a weather provider service
|
||||
*/
|
||||
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
|
||||
public static final String SERVICE_INTERFACE
|
||||
= "lineageos.weatherservice.WeatherProviderService";
|
||||
|
||||
/**
|
||||
* Name under which a {@link WeatherProviderService} publishes information about itself.
|
||||
* This meta-data must reference an XML resource containing
|
||||
* a <code><weather-provider-service></code>
|
||||
* tag.
|
||||
*/
|
||||
public static final String SERVICE_META_DATA = "lineageos.weatherservice";
|
||||
|
||||
@Override
|
||||
protected final void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
mHandler = new ServiceHandler(base.getMainLooper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IBinder onBind(Intent intent) {
|
||||
return mBinder;
|
||||
}
|
||||
|
||||
private final IWeatherProviderService.Stub mBinder = new IWeatherProviderService.Stub() {
|
||||
|
||||
@Override
|
||||
public void processWeatherUpdateRequest(final RequestInfo info) {
|
||||
mHandler.obtainMessage(ServiceHandler.MSG_ON_NEW_REQUEST, info).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCityNameLookupRequest(final RequestInfo info) {
|
||||
mHandler.obtainMessage(ServiceHandler.MSG_ON_NEW_REQUEST, info).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServiceClient(IWeatherProviderServiceClient client) {
|
||||
mHandler.obtainMessage(ServiceHandler.MSG_SET_CLIENT, client).sendToTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOngoingRequests() {
|
||||
synchronized (mWeakRequestsSet) {
|
||||
for (final ServiceRequest request : mWeakRequestsSet) {
|
||||
request.cancel();
|
||||
mWeakRequestsSet.remove(request);
|
||||
mHandler.obtainMessage(ServiceHandler.MSG_CANCEL_REQUEST, request)
|
||||
.sendToTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelRequest(int requestId) {
|
||||
synchronized (mWeakRequestsSet) {
|
||||
for (final ServiceRequest request : mWeakRequestsSet) {
|
||||
if (request.getRequestInfo().hashCode() == requestId) {
|
||||
mWeakRequestsSet.remove(request);
|
||||
request.cancel();
|
||||
mHandler.obtainMessage(ServiceHandler.MSG_CANCEL_REQUEST, request)
|
||||
.sendToTarget();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private class ServiceHandler extends Handler {
|
||||
|
||||
public ServiceHandler(Looper looper) {
|
||||
super(looper);
|
||||
}
|
||||
public static final int MSG_SET_CLIENT = 1;
|
||||
public static final int MSG_ON_NEW_REQUEST = 2;
|
||||
public static final int MSG_CANCEL_REQUEST = 3;
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case MSG_SET_CLIENT: {
|
||||
mClient = (IWeatherProviderServiceClient) msg.obj;
|
||||
if (mClient != null) {
|
||||
onConnected();
|
||||
} else {
|
||||
onDisconnected();
|
||||
}
|
||||
return;
|
||||
}
|
||||
case MSG_ON_NEW_REQUEST: {
|
||||
RequestInfo info = (RequestInfo) msg.obj;
|
||||
if (info != null) {
|
||||
ServiceRequest request = new ServiceRequest(info, mClient);
|
||||
synchronized (mWeakRequestsSet) {
|
||||
mWeakRequestsSet.add(request);
|
||||
}
|
||||
onRequestSubmitted(request);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case MSG_CANCEL_REQUEST: {
|
||||
ServiceRequest request = (ServiceRequest) msg.obj;
|
||||
onRequestCancelled(request);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The system has connected to this service.
|
||||
*/
|
||||
protected void onConnected() {
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
/**
|
||||
* The system has disconnected from this service.
|
||||
*/
|
||||
protected void onDisconnected() {
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
/**
|
||||
* A new request has been submitted to this service
|
||||
* @param request The service request to be processed by this service
|
||||
*/
|
||||
protected abstract void onRequestSubmitted(ServiceRequest request);
|
||||
|
||||
/**
|
||||
* Called when the system is not interested on this request anymore. Note that the service
|
||||
* <b>has marked the request as cancelled</b> and you must stop any ongoing operation
|
||||
* (such as pulling data from internet) that this service could've been performing to honor the
|
||||
* request.
|
||||
*
|
||||
* @param request The request cancelled by the system
|
||||
*/
|
||||
protected abstract void onRequestCancelled(ServiceRequest request);
|
||||
}
|
||||
@@ -67,7 +67,6 @@ public class LineageMetricsLogger extends MetricsLogger {
|
||||
public static final int TILE_HEADS_UP = BASE + 39;
|
||||
public static final int TILE_BATTERY_SAVER = BASE + 40;
|
||||
public static final int TILE_CAFFEINE = BASE + 41;
|
||||
public static final int WEATHER_SETTINGS = BASE + 42;
|
||||
public static final int TILE_THEMES = BASE + 43;
|
||||
public static final int TILE_LOCATION_DETAIL = BASE + 44;
|
||||
public static final int TILE_READING_MODE = BASE + 45;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<uses-permission android:name="lineageos.permission.PERFORMANCE_ACCESS" />
|
||||
<uses-permission android:name="lineageos.permission.MANAGE_LIVEDISPLAY" />
|
||||
<uses-permission android:name="lineageos.permission.OBSERVE_AUDIO_SESSIONS" />
|
||||
<uses-permission android:name="lineageos.permission.ACCESS_WEATHER_MANAGER" />
|
||||
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
|
||||
|
||||
<application android:name=".LineageOSTestApplication"
|
||||
|
||||
@@ -47,54 +47,12 @@ public class ApiV5PriorReleaseInterfaces {
|
||||
lineageAudioService.put("listAudioSessions", 1);
|
||||
}
|
||||
|
||||
//LineageWeatherManager Aidl (ILineageWeatherManager)
|
||||
static {
|
||||
Map<String, Integer> ilineageWeatherManager =
|
||||
getInternalInterfaceMap("ILineageWeatherManager");
|
||||
//ELDERBERRY BEGIN
|
||||
ilineageWeatherManager.put("updateWeather", 1);
|
||||
ilineageWeatherManager.put("lookupCity ", 2);
|
||||
ilineageWeatherManager.put("registerWeatherServiceProviderChangeListener", 3);
|
||||
ilineageWeatherManager.put("unregisterWeatherServiceProviderChangeListener", 4);
|
||||
ilineageWeatherManager.put("getActiveWeatherServiceProviderLabel", 5);
|
||||
ilineageWeatherManager.put("cancelRequest", 6);
|
||||
}
|
||||
|
||||
//RequestInfoListener Aidl (IRequestInfoListener)
|
||||
static {
|
||||
Map<String, Integer> requestInfoListener =
|
||||
getInternalInterfaceMap("IRequestInfoListener");
|
||||
//ELDERBERRY BEGIN
|
||||
requestInfoListener.put("onWeatherRequestCompleted", 1);
|
||||
requestInfoListener.put("onLookupCityRequestCompleted ", 2);
|
||||
}
|
||||
|
||||
//WeatherServiceProviderChangeListener Aidl (IWeatherServiceProviderChangeListener)
|
||||
static {
|
||||
Map<String, Integer> weatherServiceProviderChangeListener =
|
||||
getInternalInterfaceMap("IWeatherServiceProviderChangeListener");
|
||||
//ELDERBERRY BEGIN
|
||||
weatherServiceProviderChangeListener.put("onWeatherServiceProviderChanged", 1);
|
||||
}
|
||||
|
||||
//WeatherProviderService Aidl (IWeatherProviderService)
|
||||
static {
|
||||
Map<String, Integer> weatherProviderService =
|
||||
getInternalInterfaceMap("IWeatherProviderService");
|
||||
//ELDERBERRY BEGIN
|
||||
weatherProviderService.put("processWeatherUpdateRequest", 1);
|
||||
weatherProviderService.put("processCityNameLookupRequest ", 2);
|
||||
weatherProviderService.put("setServiceClient", 3);
|
||||
weatherProviderService.put("cancelOngoingRequests", 4);
|
||||
weatherProviderService.put("cancelRequest", 5);
|
||||
}
|
||||
|
||||
//WeatherProviderServiceClient Aidl (IWeatherProviderServiceClient)
|
||||
static {
|
||||
Map<String, Integer> weatherProviderServiceClient =
|
||||
getInternalInterfaceMap("IWeatherProviderServiceClient");
|
||||
//ELDERBERRY BEGIN
|
||||
weatherProviderServiceClient.put("setServiceRequestState", 1);
|
||||
requestInfoListener.put("onLookupCityRequestCompleted ", 1);
|
||||
}
|
||||
|
||||
protected static Map<String, Integer> getInternalInterfaceMap(String targetInterface) {
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import lineageos.providers.WeatherContract;
|
||||
import lineageos.weather.WeatherInfo.DayForecast;
|
||||
|
||||
public class DayForecastBuilderTest extends AndroidTestCase {
|
||||
|
||||
private static final int mConditionCode = WeatherContract.WeatherColumns.WeatherCode.HURRICANE;
|
||||
private static final double mLow = 35;
|
||||
private static final double mHigh = 58;
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcel() {
|
||||
DayForecast forecast = new DayForecast.Builder(mConditionCode).setHigh(mHigh).setLow(mLow)
|
||||
.build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
forecast.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
DayForecast forecastFromParcel = DayForecast.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(forecast, forecastFromParcel);
|
||||
assertEquals(forecast.getConditionCode(), forecastFromParcel.getConditionCode());
|
||||
assertEquals(forecast.getHigh(), forecastFromParcel.getHigh());
|
||||
assertEquals(forecast.getLow(), forecastFromParcel.getLow());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelWithDefaultValues() {
|
||||
//Condition code is required
|
||||
DayForecast forecast = new DayForecast.Builder(mConditionCode).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
forecast.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
DayForecast forecastFromParcel = DayForecast.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(forecast, forecastFromParcel);
|
||||
assertEquals(forecast.getConditionCode(), forecastFromParcel.getConditionCode());
|
||||
assertEquals(forecast.getHigh(), forecastFromParcel.getHigh());
|
||||
assertEquals(forecast.getLow(), forecastFromParcel.getLow());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testDayForecastBuilder() {
|
||||
DayForecast forecast = new DayForecast.Builder(mConditionCode).setHigh(mHigh).setLow(mLow)
|
||||
.build();
|
||||
|
||||
assertEquals(forecast.getConditionCode(), mConditionCode);
|
||||
assertEquals(forecast.getHigh(), mHigh);
|
||||
assertEquals(forecast.getLow(), mLow);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidWeatherConditionCode() {
|
||||
try {
|
||||
DayForecast forecast = new DayForecast.Builder(Integer.MIN_VALUE).build();
|
||||
throw new AssertionError("DayForecast object was built with invalid condition code!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidHighTemperature() {
|
||||
try {
|
||||
DayForecast forecast = new DayForecast.Builder(mConditionCode).setHigh(Double.NaN)
|
||||
.setLow(mLow).build();
|
||||
throw new AssertionError("DayForecast object was built with invalid high temperature!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidLowTemperature() {
|
||||
try {
|
||||
DayForecast forecast = new DayForecast.Builder(mConditionCode).setHigh(mHigh)
|
||||
.setLow(Double.NaN).build();
|
||||
throw new AssertionError("DayForecast object was built with invalid low temperature!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,242 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.location.Location;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import lineageos.weather.LineageWeatherManager;
|
||||
import lineageos.weather.LineageWeatherManager.LookupCityRequestListener;
|
||||
import lineageos.weather.LineageWeatherManager.WeatherServiceProviderChangeListener;
|
||||
import lineageos.weather.LineageWeatherManager.WeatherUpdateRequestListener;
|
||||
import lineageos.weather.ILineageWeatherManager;
|
||||
import lineageos.weather.RequestInfo;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
import org.lineageos.tests.common.MockIBinderStubForInterface;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class LineageWeatherManagerTest extends AndroidTestCase {
|
||||
|
||||
private LineageWeatherManager mWeatherManager;
|
||||
private static final String CITY_NAME = "Seattle, WA";
|
||||
private static final int COUNTDOWN = 1;
|
||||
private static final int REQUEST_ID = 42;
|
||||
private static final String MOCKED_WEATHER_PROVIDER_LABEL = "Mock'd Weather Service";
|
||||
private ILineageWeatherManager.Stub mILineageWeatherManagerSpy;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
setUpMockILineageWeatherManager();
|
||||
}
|
||||
|
||||
private void setUpMockILineageWeatherManager() {
|
||||
mWeatherManager = LineageWeatherManager.getInstance(getContext());
|
||||
Field f;
|
||||
try {
|
||||
f = mWeatherManager.getClass().getDeclaredField("sWeatherManagerService");
|
||||
f.setAccessible(true);
|
||||
|
||||
mILineageWeatherManagerSpy
|
||||
= MockIBinderStubForInterface.getMockInterface(ILineageWeatherManager.Stub.class);
|
||||
f.set(mWeatherManager, mILineageWeatherManagerSpy);
|
||||
|
||||
Mockito.doAnswer(new WeatherUpdateRequestAnswer())
|
||||
.when(mILineageWeatherManagerSpy).updateWeather(Mockito.any(RequestInfo.class));
|
||||
|
||||
Mockito.doAnswer(new LookUpCityAnswer())
|
||||
.when(mILineageWeatherManagerSpy).lookupCity(Mockito.any(RequestInfo.class));
|
||||
|
||||
Mockito.doAnswer(new GetActiveWeatherServiceProviderLabelAnser())
|
||||
.when(mILineageWeatherManagerSpy).getActiveWeatherServiceProviderLabel();
|
||||
|
||||
Mockito.doAnswer(new CancelRequestAnswer())
|
||||
.when(mILineageWeatherManagerSpy).cancelRequest(Mockito.eq(REQUEST_ID));
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class WeatherUpdateRequestAnswer implements Answer<Integer> {
|
||||
|
||||
@Override
|
||||
public Integer answer(InvocationOnMock invocation) throws Throwable {
|
||||
final RequestInfo requestInfo = (RequestInfo) invocation.getArguments()[0];
|
||||
if (requestInfo.getRequestType() == RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ) {
|
||||
assertNotNull(requestInfo.getLocation());
|
||||
} else {
|
||||
assertNotNull(requestInfo.getWeatherLocation());
|
||||
}
|
||||
final WeatherInfo weatherInfo = new WeatherInfo.Builder(CITY_NAME,
|
||||
30d, requestInfo.getTemperatureUnit()).build();
|
||||
requestInfo.getRequestListener().onWeatherRequestCompleted(requestInfo,
|
||||
LineageWeatherManager.RequestStatus.COMPLETED, weatherInfo);
|
||||
return REQUEST_ID;
|
||||
}
|
||||
}
|
||||
|
||||
private static class LookUpCityAnswer implements Answer<Integer> {
|
||||
|
||||
@Override
|
||||
public Integer answer(InvocationOnMock invocation) throws Throwable {
|
||||
final RequestInfo requestInfo = (RequestInfo) invocation.getArguments()[0];
|
||||
final List<WeatherLocation> locations = new ArrayList<>();
|
||||
final String cityName = requestInfo.getCityName();
|
||||
assertNotNull(cityName);
|
||||
locations.add(new WeatherLocation.Builder(cityName).build());
|
||||
requestInfo.getRequestListener().onLookupCityRequestCompleted(requestInfo,
|
||||
LineageWeatherManager.RequestStatus.COMPLETED, locations);
|
||||
return REQUEST_ID;
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetActiveWeatherServiceProviderLabelAnser implements Answer<String> {
|
||||
|
||||
@Override
|
||||
public String answer(InvocationOnMock invocation) throws Throwable {
|
||||
return MOCKED_WEATHER_PROVIDER_LABEL;
|
||||
}
|
||||
}
|
||||
|
||||
private static class CancelRequestAnswer implements Answer<Void> {
|
||||
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocation) throws Throwable {
|
||||
final int requestId = (Integer) invocation.getArguments()[0];
|
||||
assertEquals(requestId, REQUEST_ID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testGetActiveWeatherServiceProviderLabel() {
|
||||
String providerLabel = mWeatherManager.getActiveWeatherServiceProviderLabel();
|
||||
assertEquals(MOCKED_WEATHER_PROVIDER_LABEL, providerLabel);
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testLookupCity() {
|
||||
final CountDownLatch signal = new CountDownLatch(COUNTDOWN);
|
||||
final boolean[] error = {false};
|
||||
mWeatherManager.lookupCity(CITY_NAME,
|
||||
new LookupCityRequestListener() {
|
||||
@Override
|
||||
public void onLookupCityRequestCompleted(int status,
|
||||
List<WeatherLocation> locations) {
|
||||
final int totalLocations = locations != null ? locations.size() : 0;
|
||||
if (status != LineageWeatherManager.RequestStatus.COMPLETED
|
||||
|| totalLocations < 1) {
|
||||
error[0] = true;
|
||||
}
|
||||
signal.countDown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
signal.await();
|
||||
assertFalse(error[0]);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testRegisterListener() {
|
||||
mWeatherManager.registerWeatherServiceProviderChangeListener(mListener);
|
||||
|
||||
try {
|
||||
mWeatherManager.registerWeatherServiceProviderChangeListener(mListener);
|
||||
throw new AssertionError("Listener was registered twice!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
//EXPECTED
|
||||
}
|
||||
|
||||
mWeatherManager.unregisterWeatherServiceProviderChangeListener(mListener);
|
||||
|
||||
try {
|
||||
mWeatherManager.unregisterWeatherServiceProviderChangeListener(mListener);
|
||||
throw new AssertionError("Listener was de-registered twice!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
//EXPECTED
|
||||
}
|
||||
}
|
||||
|
||||
private WeatherServiceProviderChangeListener mListener
|
||||
= new WeatherServiceProviderChangeListener() {
|
||||
@Override
|
||||
public void onWeatherServiceProviderChanged(String providerLabel) {}
|
||||
};
|
||||
|
||||
@MediumTest
|
||||
public void testRequestWeatherUpdateByWeatherLocation() {
|
||||
final CountDownLatch signal = new CountDownLatch(COUNTDOWN);
|
||||
final WeatherLocation weatherLocation = new WeatherLocation.Builder(CITY_NAME).build();
|
||||
final boolean[] error = {false};
|
||||
mWeatherManager.requestWeatherUpdate(weatherLocation, new WeatherUpdateRequestListener() {
|
||||
@Override
|
||||
public void onWeatherRequestCompleted(int status, WeatherInfo weatherInfo) {
|
||||
if (status != LineageWeatherManager.RequestStatus.COMPLETED
|
||||
|| !weatherInfo.getCity().equals(CITY_NAME)) {
|
||||
error[0] = true;
|
||||
}
|
||||
signal.countDown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
signal.await();
|
||||
assertFalse(error[0]);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testRequestWeatherUpdateByLocation() {
|
||||
final CountDownLatch signal = new CountDownLatch(COUNTDOWN);
|
||||
final Location location = new Location("test_location_provider");
|
||||
final boolean[] error = {false};
|
||||
mWeatherManager.requestWeatherUpdate(location, new WeatherUpdateRequestListener() {
|
||||
@Override
|
||||
public void onWeatherRequestCompleted(int status, WeatherInfo weatherInfo) {
|
||||
if (status != LineageWeatherManager.RequestStatus.COMPLETED
|
||||
|| !weatherInfo.getCity().equals(CITY_NAME)) {
|
||||
error[0] = true;
|
||||
}
|
||||
signal.countDown();
|
||||
}
|
||||
});
|
||||
try {
|
||||
signal.await();
|
||||
assertFalse(error[0]);
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testCancelRequest() {
|
||||
mWeatherManager.cancelRequest(REQUEST_ID);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import lineageos.weatherservice.ServiceRequest;
|
||||
import lineageos.weatherservice.WeatherProviderService;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
public class MockWeatherProviderService extends WeatherProviderService {
|
||||
|
||||
private MockWeatherProviderService mCallTracker;
|
||||
|
||||
public MockWeatherProviderService() {
|
||||
mCallTracker = Mockito.mock(MockWeatherProviderService.class);
|
||||
}
|
||||
|
||||
public MockWeatherProviderService getCallTracker() {
|
||||
return mCallTracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onConnected() {
|
||||
mCallTracker.onConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDisconnected() {
|
||||
mCallTracker.onDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRequestSubmitted(ServiceRequest request) {
|
||||
mCallTracker.onRequestSubmitted(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRequestCancelled(ServiceRequest request) {
|
||||
mCallTracker.onRequestCancelled(request);
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import lineageos.providers.WeatherContract;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
import lineageos.weatherservice.ServiceRequestResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceRequestResultBuilderTest extends AndroidTestCase {
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelWithWeatherInfo() {
|
||||
final String cityName = "Cancun";
|
||||
final double temperature = 70;
|
||||
final int temperatureUnit = WeatherContract.WeatherColumns.TempUnit.CELSIUS;
|
||||
|
||||
WeatherInfo info = new WeatherInfo.Builder(cityName, temperature, temperatureUnit)
|
||||
.build();
|
||||
|
||||
ServiceRequestResult result = new ServiceRequestResult.Builder(info).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
result.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
ServiceRequestResult resultFromParcel
|
||||
= ServiceRequestResult.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(result, resultFromParcel);
|
||||
assertEquals(result.getWeatherInfo(), resultFromParcel.getWeatherInfo());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testsUnravelFromParcelWithWeatherLocationList() {
|
||||
|
||||
List<WeatherLocation> weatherLocationList = new ArrayList<>();
|
||||
weatherLocationList.add(new WeatherLocation.Builder("Cancun").build());
|
||||
ServiceRequestResult result = new ServiceRequestResult.Builder(weatherLocationList).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
result.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
ServiceRequestResult resultFromParcel
|
||||
= ServiceRequestResult.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(result, resultFromParcel);
|
||||
assertEquals(result.getLocationLookupList(), resultFromParcel.getLocationLookupList());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testNullWeatherInfo() {
|
||||
try {
|
||||
WeatherInfo info = null;
|
||||
ServiceRequestResult result = new ServiceRequestResult.Builder(info).build();
|
||||
throw new AssertionError("ServiceRequestResult object was built with null WeatherInfo");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testNullWeatherLocationList() {
|
||||
try {
|
||||
List<WeatherLocation> list = null;
|
||||
ServiceRequestResult result = new ServiceRequestResult.Builder(list).build();
|
||||
throw new AssertionError("ServiceRequestResult object was built with null "
|
||||
+ "WeatherLocation list");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,252 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import lineageos.providers.WeatherContract;
|
||||
import lineageos.weather.WeatherInfo;
|
||||
|
||||
public class WeatherInfoBuilderTest extends AndroidTestCase {
|
||||
|
||||
private static final String mCityName = "Cancun";
|
||||
private static final double mTemperature = 70;
|
||||
private static final int mTemperatureUnit = WeatherContract.WeatherColumns.TempUnit.CELSIUS;
|
||||
private static final double mHumidity = 45;
|
||||
private static final double mWindSpeed = 15;
|
||||
private static final double mWindDirection = 150;
|
||||
private static final int mWindSpeedUnit = WeatherContract.WeatherColumns.WindSpeedUnit.KPH;
|
||||
private static final long mTimestamp = System.currentTimeMillis();
|
||||
private static final double mTodaysHigh = 80;
|
||||
private static final double mTodaysLow = 65;
|
||||
private static final int mWeatherConditionCode
|
||||
= WeatherContract.WeatherColumns.WeatherCode.SUNNY;
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelWithDefaultValues() {
|
||||
//City name, temp and unit are required
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature, mTemperatureUnit)
|
||||
.build();
|
||||
Parcel parcel = Parcel.obtain();
|
||||
info.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherInfo weatherInfoFromParcel = WeatherInfo.CREATOR.createFromParcel(parcel);
|
||||
assertNotNull(weatherInfoFromParcel);
|
||||
|
||||
assertEquals(info, weatherInfoFromParcel);
|
||||
//City name
|
||||
assertEquals(info.getCity(), weatherInfoFromParcel.getCity());
|
||||
//Forecast list
|
||||
assertEquals(info.getForecasts(), weatherInfoFromParcel.getForecasts());
|
||||
//Humidity
|
||||
assertEquals(info.getHumidity(), weatherInfoFromParcel.getHumidity());
|
||||
//Temp
|
||||
assertEquals(info.getConditionCode(), weatherInfoFromParcel.getConditionCode());
|
||||
assertEquals(info.getTemperature(), weatherInfoFromParcel.getTemperature());
|
||||
assertEquals(info.getTemperatureUnit(), weatherInfoFromParcel.getTemperatureUnit());
|
||||
//Timestamp
|
||||
assertEquals(info.getTimestamp(), weatherInfoFromParcel.getTimestamp());
|
||||
//Today's low/high
|
||||
assertEquals(info.getTodaysHigh(), weatherInfoFromParcel.getTodaysHigh());
|
||||
assertEquals(info.getTodaysLow(), weatherInfoFromParcel.getTodaysLow());
|
||||
//Wind
|
||||
assertEquals(info.getWindDirection(), weatherInfoFromParcel.getWindDirection());
|
||||
assertEquals(info.getWindSpeed(), weatherInfoFromParcel.getWindDirection());
|
||||
assertEquals(info.getWindSpeedUnit(), weatherInfoFromParcel.getWindSpeedUnit());
|
||||
//Verify default values
|
||||
assertEquals(info.getTodaysHigh(), Double.NaN);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testWeatherInfoBuilder() {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature, mTemperatureUnit)
|
||||
.setHumidity(mHumidity)
|
||||
.setWind(mWindSpeed, mWindDirection, mWindSpeedUnit)
|
||||
.setTimestamp(mTimestamp)
|
||||
.setTodaysHigh(mTodaysHigh)
|
||||
.setTodaysLow(mTodaysLow)
|
||||
.setWeatherCondition(mWeatherConditionCode).build();
|
||||
|
||||
assertEquals(info.getCity(), mCityName);
|
||||
assertEquals(info.getTemperature(), mTemperature);
|
||||
assertEquals(info.getTemperatureUnit(), mTemperatureUnit);
|
||||
assertEquals(info.getHumidity(), mHumidity);
|
||||
assertEquals(info.getWindSpeed(), mWindSpeed);
|
||||
assertEquals(info.getWindDirection(), mWindDirection);
|
||||
assertEquals(info.getWindSpeedUnit(), mWindSpeedUnit);
|
||||
assertEquals(info.getTimestamp(), mTimestamp);
|
||||
assertEquals(info.getTodaysHigh(), mTodaysHigh);
|
||||
assertEquals(info.getTodaysLow(), mTodaysLow);
|
||||
assertEquals(info.getConditionCode(), mWeatherConditionCode);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcel() {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature, mTemperatureUnit)
|
||||
.setHumidity(mHumidity)
|
||||
.setWind(mWindSpeed, mWindDirection, mWindSpeedUnit)
|
||||
.setTimestamp(mTimestamp)
|
||||
.setTodaysHigh(mTodaysHigh)
|
||||
.setTodaysLow(mTodaysLow)
|
||||
.setWeatherCondition(mWeatherConditionCode).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
info.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherInfo infoFromParcel = WeatherInfo.CREATOR.createFromParcel(parcel);
|
||||
assertEquals(info.getCity(), infoFromParcel.getCity());
|
||||
assertEquals(info.getTemperature(), infoFromParcel.getTemperature());
|
||||
assertEquals(info.getTemperatureUnit(), infoFromParcel.getTemperatureUnit());
|
||||
assertEquals(info.getHumidity(), infoFromParcel.getHumidity());
|
||||
assertEquals(info.getWindSpeed(), infoFromParcel.getWindSpeed());
|
||||
assertEquals(info.getWindDirection(), infoFromParcel.getWindDirection());
|
||||
assertEquals(info.getWindSpeedUnit(), infoFromParcel.getWindSpeedUnit());
|
||||
assertEquals(info.getTimestamp(), infoFromParcel.getTimestamp());
|
||||
assertEquals(info.getTodaysHigh(), infoFromParcel.getTodaysHigh());
|
||||
assertEquals(info.getTodaysLow(), infoFromParcel.getTodaysLow());
|
||||
assertEquals(info.getConditionCode(), infoFromParcel.getConditionCode());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testNullCityName() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(null, mTemperature, mTemperatureUnit)
|
||||
.build();
|
||||
throw new AssertionError("WeatherInfo object built with null city name!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidTemperature() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, Double.NaN, mTemperatureUnit)
|
||||
.build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid temperature value!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidTemperatureUnit() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,Integer.MIN_VALUE)
|
||||
.build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid temperature unit!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testNullForecastList() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setForecast(null).build();
|
||||
throw new AssertionError("WeatherInfo object built with null forecast list!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidWeatherConditionCode() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setWeatherCondition(Integer.MIN_VALUE).build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid weather "
|
||||
+ "condition code!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidHumidity() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setHumidity(Double.NaN).build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid humidity value!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidWindSpeed() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setWind(Double.NaN, mWindDirection, mWindSpeedUnit)
|
||||
.build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid wind speed!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidWindDirection() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setWind(mWindSpeed, Double.NaN, mWindSpeedUnit)
|
||||
.build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid wind direction!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidWindSpeedUnit(){
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setWind(mWindSpeed, mWindDirection, Integer.MIN_VALUE).build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid wind speed unit!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidTodaysLow() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setTodaysLow(Double.NaN).build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid low temp!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testInvalidTodaysHigh() {
|
||||
try {
|
||||
WeatherInfo info = new WeatherInfo.Builder(mCityName, mTemperature,mTemperatureUnit)
|
||||
.setTodaysHigh(Double.NaN).build();
|
||||
throw new AssertionError("WeatherInfo object built with invalid high temp!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* EXPECTED */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
|
||||
public class WeatherLocationBuilderTest extends AndroidTestCase {
|
||||
|
||||
private static final String mCityId = "can1";
|
||||
private static final String mCityName = "Cancun";
|
||||
private static final String mState = "Quintana Roo";
|
||||
private static final String mCountryId = "MX";
|
||||
private static final String mCountry = "Mexico";
|
||||
private static final String mZipCode = "77510";
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelTwoArgsConstructor() {
|
||||
WeatherLocation location = new WeatherLocation.Builder(mCityId, mCityName)
|
||||
.setState(mState).setPostalCode(mZipCode).setCountryId(mCountryId)
|
||||
.setCountry(mCountry).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
location.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherLocation locationFromParcel = WeatherLocation.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(location, locationFromParcel);
|
||||
assertEquals(location.getCityId(), locationFromParcel.getCityId());
|
||||
assertEquals(location.getCity(), locationFromParcel.getCity());
|
||||
assertEquals(location.getState(), locationFromParcel.getState());
|
||||
assertEquals(location.getPostalCode(), locationFromParcel.getPostalCode());
|
||||
assertEquals(location.getCountry(), locationFromParcel.getCountry());
|
||||
assertEquals(location.getCountryId(), locationFromParcel.getCountryId());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelOneArgConstructor() {
|
||||
WeatherLocation location = new WeatherLocation.Builder(mCityName)
|
||||
.setState(mState).setPostalCode(mZipCode).setCountryId(mCountryId)
|
||||
.setCountry(mCountry).build();
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
location.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherLocation locationFromParcel = WeatherLocation.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(location, locationFromParcel);
|
||||
assertEquals(location.getCityId(), locationFromParcel.getCityId());
|
||||
assertEquals(location.getCity(), locationFromParcel.getCity());
|
||||
assertEquals(location.getState(), locationFromParcel.getState());
|
||||
assertEquals(location.getPostalCode(), locationFromParcel.getPostalCode());
|
||||
assertEquals(location.getCountry(), locationFromParcel.getCountry());
|
||||
assertEquals(location.getCountryId(), locationFromParcel.getCountryId());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelWithDefaultsOneArgConstructor() {
|
||||
WeatherLocation location = new WeatherLocation.Builder(mCityName).build();
|
||||
Parcel parcel = Parcel.obtain();
|
||||
location.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherLocation locationFromParcel = WeatherLocation.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(location, locationFromParcel);
|
||||
assertEquals(location.getCityId(), locationFromParcel.getCityId());
|
||||
assertEquals(location.getCity(), locationFromParcel.getCity());
|
||||
assertEquals(location.getState(), locationFromParcel.getState());
|
||||
assertEquals(location.getPostalCode(), locationFromParcel.getPostalCode());
|
||||
assertEquals(location.getCountry(), locationFromParcel.getCountry());
|
||||
assertEquals(location.getCountryId(), locationFromParcel.getCountryId());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
public void testUnravelFromParcelWithDefaultsTwoArgsConstructor() {
|
||||
WeatherLocation location = new WeatherLocation.Builder(mCityId, mCityName).build();
|
||||
Parcel parcel = Parcel.obtain();
|
||||
location.writeToParcel(parcel, 0);
|
||||
|
||||
parcel.setDataPosition(0);
|
||||
|
||||
WeatherLocation locationFromParcel = WeatherLocation.CREATOR.createFromParcel(parcel);
|
||||
|
||||
assertEquals(location, locationFromParcel);
|
||||
assertEquals(location.getCityId(), locationFromParcel.getCityId());
|
||||
assertEquals(location.getCity(), locationFromParcel.getCity());
|
||||
assertEquals(location.getState(), locationFromParcel.getState());
|
||||
assertEquals(location.getPostalCode(), locationFromParcel.getPostalCode());
|
||||
assertEquals(location.getCountry(), locationFromParcel.getCountry());
|
||||
assertEquals(location.getCountryId(), locationFromParcel.getCountryId());
|
||||
}
|
||||
|
||||
|
||||
@SmallTest
|
||||
public void testWeatherLocationBuilder() {
|
||||
WeatherLocation location = new WeatherLocation.Builder(mCityId, mCityName)
|
||||
.setState(mState).setPostalCode(mZipCode).setCountryId(mCountryId)
|
||||
.setCountry(mCountry).build();
|
||||
|
||||
assertEquals(location.getCityId(), mCityId);
|
||||
assertEquals(location.getCity(), mCityName);
|
||||
assertEquals(location.getState(), mState);
|
||||
assertEquals(location.getPostalCode(), mZipCode);
|
||||
assertEquals(location.getCountryId(), mCountryId);
|
||||
assertEquals(location.getCountry(), mCountry);
|
||||
}
|
||||
}
|
||||
@@ -1,303 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.tests.weather.unit;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.IBinder;
|
||||
import lineageos.weather.LineageWeatherManager;
|
||||
import lineageos.weather.RequestInfo;
|
||||
import lineageos.weather.WeatherLocation;
|
||||
import lineageos.weatherservice.IWeatherProviderService;
|
||||
import lineageos.weatherservice.IWeatherProviderServiceClient;
|
||||
import lineageos.weatherservice.ServiceRequest;
|
||||
import lineageos.weatherservice.ServiceRequestResult;
|
||||
import org.lineageos.tests.common.MockIBinderStubForInterface;
|
||||
import org.lineageos.tests.common.ThreadServiceTestCase;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class WeatherProviderServiceTest extends ThreadServiceTestCase<MockWeatherProviderService> {
|
||||
|
||||
public WeatherProviderServiceTest() {
|
||||
super(MockWeatherProviderService.class);
|
||||
}
|
||||
|
||||
private static final String CITY_NAME = "Seattle";
|
||||
private static final int TIMEOUT = 5000;
|
||||
|
||||
public void testCityNameLookupRequest() throws Exception {
|
||||
IBinder binder = bindService((ServiceRunnable) null);
|
||||
assertNotNull(binder);
|
||||
|
||||
final IWeatherProviderService provider = IWeatherProviderService.Stub.asInterface(binder);
|
||||
assertNotNull(provider);
|
||||
|
||||
provider.processCityNameLookupRequest(
|
||||
buildMockdRequestInfo(RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ));
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
assertEquals(request.getRequestInfo().getRequestType(),
|
||||
RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ);
|
||||
|
||||
assertEquals(request.getRequestInfo().getCityName(), CITY_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testWeatherUpdateRequestByWeatherLocation() throws Exception {
|
||||
IBinder binder = bindService((ServiceRunnable) null);
|
||||
assertNotNull(binder);
|
||||
|
||||
final IWeatherProviderService provider = IWeatherProviderService.Stub.asInterface(binder);
|
||||
assertNotNull(provider);
|
||||
|
||||
provider.processWeatherUpdateRequest(
|
||||
buildMockdRequestInfo(RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ));
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
assertEquals(request.getRequestInfo().getRequestType(),
|
||||
RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ);
|
||||
|
||||
WeatherLocation weatherLocation = request.getRequestInfo().getWeatherLocation();
|
||||
assertNotNull(weatherLocation);
|
||||
assertEquals(weatherLocation.getCity(), CITY_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testWeatherUpdateRequestByGeoLocation() throws Exception {
|
||||
IBinder binder = bindService((ServiceRunnable) null);
|
||||
assertNotNull(binder);
|
||||
|
||||
final IWeatherProviderService provider = IWeatherProviderService.Stub.asInterface(binder);
|
||||
assertNotNull(provider);
|
||||
|
||||
provider.processWeatherUpdateRequest(
|
||||
buildMockdRequestInfo(RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ));
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
assertEquals(request.getRequestInfo().getRequestType(),
|
||||
RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ);
|
||||
|
||||
Location location = request.getRequestInfo().getLocation();
|
||||
assertNotNull(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testServiceRequestResult() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch(3);
|
||||
IBinder binder = bindService((ServiceRunnable) null);
|
||||
assertNotNull(binder);
|
||||
|
||||
final IWeatherProviderService provider = IWeatherProviderService.Stub.asInterface(binder);
|
||||
assertNotNull(provider);
|
||||
|
||||
IWeatherProviderServiceClient client =
|
||||
MockIBinderStubForInterface.getMockInterface(
|
||||
IWeatherProviderServiceClient.Stub.class);
|
||||
|
||||
Mockito.doAnswer(new Answer() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
RequestInfo requestInfo = (RequestInfo) invocation.getArguments()[0];
|
||||
int result = (int) invocation.getArguments()[2];
|
||||
|
||||
assertNotNull(requestInfo);
|
||||
assertEquals(result, LineageWeatherManager.RequestStatus.FAILED);
|
||||
|
||||
latch.countDown();
|
||||
return null;
|
||||
}
|
||||
}).when(client)
|
||||
.setServiceRequestState(Mockito.any(RequestInfo.class),
|
||||
Mockito.any(ServiceRequestResult.class),
|
||||
Mockito.eq(LineageWeatherManager.RequestStatus.FAILED));
|
||||
|
||||
Mockito.doAnswer(new Answer() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
|
||||
RequestInfo requestInfo = (RequestInfo) invocation.getArguments()[0];
|
||||
int result = (int) invocation.getArguments()[2];
|
||||
|
||||
assertNotNull(requestInfo);
|
||||
assertEquals(result, LineageWeatherManager.RequestStatus.SUBMITTED_TOO_SOON);
|
||||
|
||||
latch.countDown();
|
||||
return null;
|
||||
}
|
||||
}).when(client)
|
||||
.setServiceRequestState(Mockito.any(RequestInfo.class),
|
||||
Mockito.any(ServiceRequestResult.class),
|
||||
Mockito.eq(LineageWeatherManager.RequestStatus.SUBMITTED_TOO_SOON));
|
||||
|
||||
Mockito.doAnswer(new Answer() {
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
RequestInfo requestInfo = (RequestInfo) invocation.getArguments()[0];
|
||||
ServiceRequestResult requestResult
|
||||
= (ServiceRequestResult) invocation.getArguments()[1];
|
||||
int result = (int) invocation.getArguments()[2];
|
||||
|
||||
assertNotNull(requestInfo);
|
||||
assertNotNull(requestResult);
|
||||
assertNotNull(requestResult.getLocationLookupList());
|
||||
assertEquals(result, LineageWeatherManager.RequestStatus.COMPLETED);
|
||||
|
||||
latch.countDown();
|
||||
return null;
|
||||
}
|
||||
}).when(client)
|
||||
.setServiceRequestState(Mockito.any(RequestInfo.class),
|
||||
Mockito.any(ServiceRequestResult.class),
|
||||
Mockito.eq(LineageWeatherManager.RequestStatus.COMPLETED));
|
||||
|
||||
provider.setServiceClient(client);
|
||||
|
||||
final RequestInfo requestInfo
|
||||
= buildMockdRequestInfo(RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ);
|
||||
|
||||
Mockito.reset(getService().getCallTracker());
|
||||
provider.processCityNameLookupRequest(requestInfo);
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
request.fail();
|
||||
}
|
||||
});
|
||||
|
||||
Mockito.reset(getService().getCallTracker());
|
||||
provider.processCityNameLookupRequest(requestInfo);
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
request.reject(LineageWeatherManager.RequestStatus.SUBMITTED_TOO_SOON);
|
||||
}
|
||||
});
|
||||
|
||||
Mockito.reset(getService().getCallTracker());
|
||||
provider.processCityNameLookupRequest(requestInfo);
|
||||
runOnServiceThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ArgumentCaptor<ServiceRequest> params
|
||||
= ArgumentCaptor.forClass(ServiceRequest.class);
|
||||
|
||||
Mockito.verify(getService().getCallTracker(), Mockito.timeout(TIMEOUT).times(1))
|
||||
.onRequestSubmitted(params.capture());
|
||||
|
||||
ServiceRequest request = params.getValue();
|
||||
|
||||
List<WeatherLocation> locations = new ArrayList<>();
|
||||
locations.add(new WeatherLocation.Builder(CITY_NAME).build());
|
||||
ServiceRequestResult result = new ServiceRequestResult.Builder(locations).build();
|
||||
request.complete(result);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
latch.await();
|
||||
} catch (InterruptedException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private RequestInfo buildMockdRequestInfo(int requestType) {
|
||||
try {
|
||||
Constructor<RequestInfo> c = RequestInfo.class.getDeclaredConstructor();
|
||||
c.setAccessible(true);
|
||||
RequestInfo info = c.newInstance();
|
||||
Field type;
|
||||
type = info.getClass().getDeclaredField("mRequestType");
|
||||
type.setAccessible(true);
|
||||
type.set(info, requestType);
|
||||
switch (requestType) {
|
||||
case RequestInfo.TYPE_LOOKUP_CITY_NAME_REQ:
|
||||
Field cityName;
|
||||
cityName = info.getClass().getDeclaredField("mCityName");
|
||||
cityName.setAccessible(true);
|
||||
cityName.set(info, CITY_NAME);
|
||||
break;
|
||||
case RequestInfo.TYPE_WEATHER_BY_WEATHER_LOCATION_REQ:
|
||||
Field weatherLocation;
|
||||
weatherLocation = info.getClass().getDeclaredField("mWeatherLocation");
|
||||
weatherLocation.setAccessible(true);
|
||||
weatherLocation.set(info, new WeatherLocation.Builder(CITY_NAME).build());
|
||||
break;
|
||||
case RequestInfo.TYPE_WEATHER_BY_GEO_LOCATION_REQ:
|
||||
Field location;
|
||||
location = info.getClass().getDeclaredField("mLocation");
|
||||
location.setAccessible(true);
|
||||
location.set(info, new Location("dummy_location_provider"));
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("Unknown request type");
|
||||
}
|
||||
return info;
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user