Initial commit.
This commit is contained in:
commit
bf92d2715b
84 changed files with 2711 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
*.iml
|
||||
gen
|
||||
bin
|
||||
build
|
||||
39
Android.mk
Normal file
39
Android.mk
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (c) 2014 μg 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.
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
unified_dir := ../UnifiedNlp
|
||||
res_dir := res $(unified_dir)/res
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
LOCAL_SRC_FILES += $(call all-Iaidl-files-under, src)
|
||||
LOCAL_SRC_FILES += $(call all-java-files-under, $(unified_dir)/src)
|
||||
LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dir))
|
||||
LOCAL_AAPT_FLAGS := --auto-add-overlay --extra-packages org.microg.nlp
|
||||
|
||||
# For some reason framework has to be added here else GeocoderParams is not found,
|
||||
# this way everything else is duplicated, but atleast compiles...
|
||||
LOCAL_JAVA_LIBRARIES := com.google.android.maps framework com.android.location.provider
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := UnifiedNlpApi
|
||||
LOCAL_PACKAGE_NAME := GmsCore
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
88
AndroidManifest.xml
Normal file
88
AndroidManifest.xml
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.android.gms"
|
||||
android:versionCode="4243036">
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
|
||||
<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/nlp_app_icon"
|
||||
android:label="@string/nlp_app_name">
|
||||
<uses-library
|
||||
android:name="com.android.location.provider"
|
||||
android:required="false" />
|
||||
<uses-library
|
||||
android:name="com.google.android.maps"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Jelly Bean / KitKat -->
|
||||
<service
|
||||
android:name="org.microg.nlp.location.LocationServiceV2"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<!-- KitKat changed the action name but nothing else, hence we handle it the same -->
|
||||
<action android:name="com.android.location.service.v3.NetworkLocationProvider" />
|
||||
<action android:name="com.android.location.service.v2.NetworkLocationProvider" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="serviceVersion"
|
||||
android:value="2" />
|
||||
<meta-data
|
||||
android:name="serviceIsMultiuser"
|
||||
android:value="false" />
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name="org.microg.nlp.geocode.GeocodeServiceV1"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<!-- Jelly Bean changed the action name but nothing else, hence we handle it the same -->
|
||||
<action android:name="com.android.location.service.GeocodeProvider" />
|
||||
<action android:name="com.google.android.location.GeocodeProvider" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="serviceVersion"
|
||||
android:value="2" />
|
||||
<meta-data
|
||||
android:name="serviceIsMultiuser"
|
||||
android:value="false" />
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name="org.microg.nlp.ui.LocationBackendConfig"
|
||||
android:theme="@android:style/Theme.Holo.Light">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver android:name="org.microg.nlp.PackageReceiver" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.PACKAGE_ADDED" />
|
||||
<action android:name="android.intent.action.PACKAGE_CHANGED" />
|
||||
<action android:name="android.intent.action.PACKAGE_UPGRADED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REMOVED" />
|
||||
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||
<action android:name="android.intent.action.PACKAGE_RESTARTED" />
|
||||
|
||||
<data android:scheme="package" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
||||
<service android:name="com.google.android.location.internal.GoogleLocationManagerService" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
5
proguard.flags
Normal file
5
proguard.flags
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Disable ProGuard Notes, they won't help here
|
||||
-dontnote
|
||||
|
||||
# Keep dynamically loaded GMS classes
|
||||
-keep public class com.google.android.gms.maps.internal.CreatorImpl
|
||||
3
res/drawable/ic_plusone_medium.xml
Normal file
3
res/drawable/ic_plusone_medium.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
||||
3
res/drawable/ic_plusone_small.xml
Normal file
3
res/drawable/ic_plusone_small.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
||||
3
res/drawable/ic_plusone_standard.xml
Normal file
3
res/drawable/ic_plusone_standard.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
||||
3
res/drawable/ic_plusone_tall.xml
Normal file
3
res/drawable/ic_plusone_tall.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector>
|
||||
</selector>
|
||||
4
res/values/dimens.xml
Normal file
4
res/values/dimens.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="maps_watermark_margin">5.0dip</dimen>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
package com.google.android.gms.common.internal;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
|
||||
public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub {
|
||||
@Override
|
||||
public void getPlusService(IGmsCallbacks callback, int code, String str1, String str2, String[] paramArrayOfString, String str3, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Plus service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPanoramaService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Panorama service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppDataSearchService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("App Data Search service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWalletService(IGmsCallbacks callback, int code) throws RemoteException {
|
||||
throw new IllegalArgumentException("Wallet service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPeopleService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("People service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getReportingService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Reporting service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLocationService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Location service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Location Manager service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGamesService(IGmsCallbacks callback, int code, String str1, String str2, String[] args, String str3, IBinder binder, String str4, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Games service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAppStateService(IGmsCallbacks callback, int code, String str1, String str2, String[] args) throws RemoteException {
|
||||
throw new IllegalArgumentException("App State service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPlayLogService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Play Log service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAdMobService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("AdMob service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDroidGuardService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("DroidGuard service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLockboxService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lockbox service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCastMirroringService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast Mirroring service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNetworkQualityService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Network Quality service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Identity service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGoogleFeedbackService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Google Feedback service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCastService(IGmsCallbacks callback, int code, String str, IBinder binder, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Cast service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDriveService(IGmsCallbacks callback, int code, String str1, String[] args, String str2, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Drive service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getLightweightAppDataSearchService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Lightweight App Data Search service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSearchAdministrationService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Search Administration service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAutoBackupService(IGmsCallbacks callback, int code, String str, Bundle params) throws RemoteException {
|
||||
throw new IllegalArgumentException("Auto Backup service not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAddressService(IGmsCallbacks callback, int code, String str) throws RemoteException {
|
||||
throw new IllegalArgumentException("Address service not supported");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.google.android.gms.common.internal;
|
||||
|
||||
interface IGmsCallbacks {
|
||||
void onPostInitComplete(int code, IBinder binder, in Bundle params);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.google.android.gms.common.internal;
|
||||
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
interface IGmsServiceBroker {
|
||||
void getPlusService(IGmsCallbacks callback, int code, String str1, String str2, in String[] paramArrayOfString, String str3, in Bundle params);
|
||||
void getPanoramaService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getAppDataSearchService(IGmsCallbacks callback, int code, String str);
|
||||
void getWalletService(IGmsCallbacks callback, int code);
|
||||
void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getLocationService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getGamesService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args, String str3, IBinder binder, String str4, in Bundle params);
|
||||
void getAppStateService(IGmsCallbacks callback, int code, String str1, String str2, in String[] args);
|
||||
void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getAdMobService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getDroidGuardService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getLockboxService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getCastMirroringService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getNetworkQualityService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getGoogleFeedbackService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getCastService(IGmsCallbacks callback, int code, String str, IBinder binder, in Bundle params);
|
||||
void getDriveService(IGmsCallbacks callback, int code, String str1, in String[] args, String str2, in Bundle params);
|
||||
void getLightweightAppDataSearchService(IGmsCallbacks callback, int code, String str);
|
||||
void getSearchAdministrationService(IGmsCallbacks callback, int code, String str);
|
||||
void getAutoBackupService(IGmsCallbacks callback, int code, String str, in Bundle params);
|
||||
void getAddressService(IGmsCallbacks callback, int code, String str);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.google.android.gms.common.safeparcel;
|
||||
|
||||
import android.os.Parcelable;
|
||||
|
||||
public interface SafeParcelable extends Parcelable {
|
||||
public static final String NULL = "SAFE_PARCELABLE_NULL_STRING";
|
||||
int SAFE_PARCEL_MAGIC = 20293;
|
||||
}
|
||||
104
src/com/google/android/gms/common/safeparcel/SafeReader.java
Normal file
104
src/com/google/android/gms/common/safeparcel/SafeReader.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package com.google.android.gms.common.safeparcel;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class SafeReader {
|
||||
public static int halfOf(int i) {
|
||||
return i & 0xFFFF;
|
||||
}
|
||||
|
||||
public static int readSingleInt(Parcel parcel) {
|
||||
return parcel.readInt();
|
||||
}
|
||||
|
||||
private static int readStart(Parcel parcel, int first) {
|
||||
if ((first & 0xFFFF0000) != -65536)
|
||||
return first >> 16 & 0xFFFF;
|
||||
return parcel.readInt();
|
||||
}
|
||||
|
||||
private static void readStart(Parcel parcel, int position, int length) {
|
||||
int i = readStart(parcel, position);
|
||||
if (i != length)
|
||||
throw new ReadException("Expected size " + length + " got " + i + " (0x" + Integer.toHexString(i) + ")", parcel);
|
||||
}
|
||||
|
||||
public static int readStart(Parcel parcel) {
|
||||
int first = readSingleInt(parcel);
|
||||
int length = readStart(parcel, first);
|
||||
int start = parcel.dataPosition();
|
||||
if (halfOf(first) != SafeParcelable.SAFE_PARCEL_MAGIC)
|
||||
throw new ReadException("Expected object header. Got 0x" + Integer.toHexString(first), parcel);
|
||||
int end = start + length;
|
||||
if ((end < start) || (end > parcel.dataSize()))
|
||||
throw new ReadException("Size read is invalid start=" + start + " end=" + end, parcel);
|
||||
return end;
|
||||
}
|
||||
|
||||
public static int readInt(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 4);
|
||||
return parcel.readInt();
|
||||
}
|
||||
|
||||
public static byte readByte(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 4);
|
||||
return (byte) parcel.readInt();
|
||||
}
|
||||
|
||||
public static short readShort(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 4);
|
||||
return (short) parcel.readInt();
|
||||
}
|
||||
|
||||
public static boolean readBool(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 4);
|
||||
return parcel.readInt() != 0;
|
||||
}
|
||||
|
||||
public static long readLong(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 8);
|
||||
return parcel.readLong();
|
||||
}
|
||||
|
||||
public static float readFloat(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 4);
|
||||
return parcel.readFloat();
|
||||
}
|
||||
|
||||
public static double readDouble(Parcel parcel, int position) {
|
||||
readStart(parcel, position, 8);
|
||||
return parcel.readDouble();
|
||||
}
|
||||
public static IBinder readBinder(Parcel parcel, int position) {
|
||||
int length = readStart(parcel, position);
|
||||
int start = parcel.dataPosition();
|
||||
if (length == 0)
|
||||
return null;
|
||||
IBinder binder = parcel.readStrongBinder();
|
||||
parcel.setDataPosition(start + length);
|
||||
return binder;
|
||||
}
|
||||
|
||||
public static <T extends Parcelable> T readParcelable(Parcel parcel, int position, Parcelable.Creator<T> creator) {
|
||||
int length = readStart(parcel, position);
|
||||
int start = parcel.dataPosition();
|
||||
if (length == 0)
|
||||
return null;
|
||||
T t = creator.createFromParcel(parcel);
|
||||
parcel.setDataPosition(start + length);
|
||||
return t;
|
||||
}
|
||||
|
||||
public static void skip(Parcel parcel, int position) {
|
||||
int i = readStart(parcel, position);
|
||||
parcel.setDataPosition(parcel.dataPosition() + i);
|
||||
}
|
||||
|
||||
public static class ReadException extends RuntimeException {
|
||||
public ReadException(String message, Parcel parcel) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
212
src/com/google/android/gms/common/safeparcel/SafeWriter.java
Normal file
212
src/com/google/android/gms/common/safeparcel/SafeWriter.java
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
package com.google.android.gms.common.safeparcel;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SafeWriter {
|
||||
|
||||
private static void writeStart(Parcel parcel, int position, int length) {
|
||||
if (length >= 65535) {
|
||||
parcel.writeInt(0xFFFF0000 | position);
|
||||
parcel.writeInt(length);
|
||||
} else {
|
||||
parcel.writeInt(length << 16 | position);
|
||||
}
|
||||
}
|
||||
|
||||
public static int writeStart(Parcel parcel) {
|
||||
return writeStart(parcel, SafeParcelable.SAFE_PARCEL_MAGIC);
|
||||
}
|
||||
|
||||
private static int writeStart(Parcel parcel, int position) {
|
||||
parcel.writeInt(0xFFFF0000 | position);
|
||||
parcel.writeInt(0);
|
||||
return parcel.dataPosition();
|
||||
}
|
||||
|
||||
public static void writeEnd(Parcel parcel, int start) {
|
||||
int end = parcel.dataPosition();
|
||||
int length = end - start;
|
||||
parcel.setDataPosition(start - 4);
|
||||
parcel.writeInt(length);
|
||||
parcel.setDataPosition(end);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, boolean val) {
|
||||
writeStart(parcel, position, 4);
|
||||
parcel.writeInt(val ? 1 : 0);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, byte val) {
|
||||
writeStart(parcel, position, 4);
|
||||
parcel.writeInt(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, short val) {
|
||||
writeStart(parcel, position, 4);
|
||||
parcel.writeInt(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, int val) {
|
||||
writeStart(parcel, position, 4);
|
||||
parcel.writeInt(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, long val) {
|
||||
writeStart(parcel, position, 8);
|
||||
parcel.writeLong(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, float val) {
|
||||
writeStart(parcel, position, 4);
|
||||
parcel.writeFloat(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, double val) {
|
||||
writeStart(parcel, position, 8);
|
||||
parcel.writeDouble(val);
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, String val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeString(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, Parcelable val, int flags, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
val.writeToParcel(parcel, flags);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, Bundle val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeBundle(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, byte[] val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeByteArray(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, String[] val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeStringArray(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeStringList(Parcel parcel, int position, List<String> val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeStringList(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Parcelable> void writeArrayPart(Parcel parcel, T val, int flags) {
|
||||
int before = parcel.dataPosition();
|
||||
parcel.writeInt(1);
|
||||
int start = parcel.dataPosition();
|
||||
val.writeToParcel(parcel, flags);
|
||||
int end = parcel.dataPosition();
|
||||
parcel.setDataPosition(before);
|
||||
parcel.writeInt(end - start);
|
||||
parcel.setDataPosition(end);
|
||||
}
|
||||
|
||||
public static <T extends Parcelable> void write(Parcel parcel, int position, T[] val, int flags, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeInt(val.length);
|
||||
for (T t : val) {
|
||||
if (t == null) {
|
||||
parcel.writeInt(0);
|
||||
} else {
|
||||
writeArrayPart(parcel, t, flags);
|
||||
}
|
||||
}
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, Parcel val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.appendFrom(val, 0, val.dataSize());
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, List val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeList(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(Parcel parcel, int position, IBinder val, boolean mayNull) {
|
||||
if (val == null) {
|
||||
if (mayNull) {
|
||||
writeStart(parcel, position, 0);
|
||||
}
|
||||
} else {
|
||||
int start = writeStart(parcel, position);
|
||||
parcel.writeStrongBinder(val);
|
||||
writeEnd(parcel, start);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
4
src/com/google/android/gms/dynamic/IObjectWrapper.aidl
Normal file
4
src/com/google/android/gms/dynamic/IObjectWrapper.aidl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package com.google.android.gms.dynamic;
|
||||
|
||||
interface IObjectWrapper {
|
||||
}
|
||||
45
src/com/google/android/gms/dynamic/ObjectWrapper.java
Normal file
45
src/com/google/android/gms/dynamic/ObjectWrapper.java
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
package com.google.android.gms.dynamic;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.view.View;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ObjectWrapper<T> extends IObjectWrapper.Stub {
|
||||
private final T t;
|
||||
|
||||
public ObjectWrapper(T t) {
|
||||
this.t = t;
|
||||
}
|
||||
|
||||
public static Object unwrap(IObjectWrapper obj) {
|
||||
if (obj instanceof ObjectWrapper) {
|
||||
return ((ObjectWrapper) obj).t;
|
||||
}
|
||||
IBinder binder = obj.asBinder();
|
||||
Field[] fields = binder.getClass().getDeclaredFields();
|
||||
if (fields.length != 1) {
|
||||
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly *one* declared private field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
|
||||
}
|
||||
Field field = fields[0];
|
||||
if (!field.isAccessible()) {
|
||||
field.setAccessible(true);
|
||||
try {
|
||||
Object wrapped = field.get(binder);
|
||||
return wrapped;
|
||||
} catch (NullPointerException localNullPointerException) {
|
||||
throw new IllegalArgumentException("Binder object is null.", localNullPointerException);
|
||||
} catch (IllegalArgumentException localIllegalArgumentException) {
|
||||
throw new IllegalArgumentException("remoteBinder is the wrong class.", localIllegalArgumentException);
|
||||
} catch (IllegalAccessException localIllegalAccessException) {
|
||||
throw new IllegalArgumentException("Could not access the field in remoteBinder.", localIllegalAccessException);
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("The concrete class implementing IObjectWrapper must have exactly one declared *private* field for the wrapped object. Preferably, this is an instance of the ObjectWrapper<T> class.");
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> ObjectWrapper<T> wrap(T t) {
|
||||
return new ObjectWrapper<T>(t);
|
||||
}
|
||||
}
|
||||
3
src/com/google/android/gms/maps/GoogleMapOptions.aidl
Normal file
3
src/com/google/android/gms/maps/GoogleMapOptions.aidl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.maps;
|
||||
|
||||
parcelable GoogleMapOptions;
|
||||
104
src/com/google/android/gms/maps/GoogleMapOptions.java
Normal file
104
src/com/google/android/gms/maps/GoogleMapOptions.java
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
package com.google.android.gms.maps;
|
||||
|
||||
import android.os.Parcel;
|
||||
import com.google.android.gms.common.safeparcel.SafeParcelable;
|
||||
import com.google.android.gms.common.safeparcel.SafeReader;
|
||||
import com.google.android.gms.common.safeparcel.SafeWriter;
|
||||
import com.google.android.gms.maps.model.CameraPosition;
|
||||
|
||||
public class GoogleMapOptions implements SafeParcelable {
|
||||
private int versionCode;
|
||||
private int zOrderOnTop;
|
||||
private boolean useViewLifecycleInFragment;
|
||||
private int mapType;
|
||||
private CameraPosition camera;
|
||||
private boolean zoomControlsEnabled;
|
||||
private boolean compassEnabled;
|
||||
private boolean scrollGesturesEnabled;
|
||||
private boolean zoomGesturesEnabled;
|
||||
private boolean tiltGesturesEnabled;
|
||||
private boolean rotateGesturesEnabled;
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
int start = SafeWriter.writeStart(dest);
|
||||
SafeWriter.write(dest, 1, versionCode);
|
||||
SafeWriter.write(dest, 2, zOrderOnTop);
|
||||
SafeWriter.write(dest, 3, useViewLifecycleInFragment);
|
||||
SafeWriter.write(dest, 4, mapType);
|
||||
SafeWriter.write(dest, 5, camera, flags, false);
|
||||
SafeWriter.write(dest, 6, zoomControlsEnabled);
|
||||
SafeWriter.write(dest, 7, compassEnabled);
|
||||
SafeWriter.write(dest, 8, scrollGesturesEnabled);
|
||||
SafeWriter.write(dest, 9, zoomGesturesEnabled);
|
||||
SafeWriter.write(dest, 10, tiltGesturesEnabled);
|
||||
SafeWriter.write(dest, 11, rotateGesturesEnabled);
|
||||
SafeWriter.writeEnd(dest, start);
|
||||
}
|
||||
|
||||
public GoogleMapOptions() {
|
||||
}
|
||||
|
||||
private GoogleMapOptions(Parcel in) {
|
||||
int end = SafeReader.readStart(in);
|
||||
while (in.dataPosition() < end) {
|
||||
int position = SafeReader.readSingleInt(in);
|
||||
switch (SafeReader.halfOf(position)) {
|
||||
case 1:
|
||||
versionCode = SafeReader.readInt(in, position);
|
||||
break;
|
||||
case 2:
|
||||
zOrderOnTop = SafeReader.readInt(in, position);
|
||||
break;
|
||||
case 3:
|
||||
useViewLifecycleInFragment = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 4:
|
||||
mapType = SafeReader.readInt(in, position);
|
||||
break;
|
||||
case 5:
|
||||
camera = SafeReader.readParcelable(in, position, CameraPosition.CREATOR);
|
||||
break;
|
||||
case 6:
|
||||
zoomControlsEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 7:
|
||||
compassEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 8:
|
||||
scrollGesturesEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 9:
|
||||
zoomGesturesEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 10:
|
||||
tiltGesturesEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
case 11:
|
||||
rotateGesturesEnabled = SafeReader.readBool(in, position);
|
||||
break;
|
||||
default:
|
||||
SafeReader.skip(in, position);
|
||||
}
|
||||
}
|
||||
if (in.dataPosition() > end) {
|
||||
throw new SafeReader.ReadException("Overread allowed size end=" + end, in);
|
||||
}
|
||||
}
|
||||
|
||||
public static Creator<GoogleMapOptions> CREATOR = new Creator<GoogleMapOptions>() {
|
||||
public GoogleMapOptions createFromParcel(Parcel source) {
|
||||
return new GoogleMapOptions(source);
|
||||
}
|
||||
|
||||
public GoogleMapOptions[] newArray(int size) {
|
||||
return new GoogleMapOptions[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.google.android.gms.maps.internal;
|
||||
|
||||
public interface CameraUpdate {
|
||||
void update(GoogleMapImpl map);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue