Split constant-pool, add some components for gcm

This commit is contained in:
Marvin W 2016-01-22 03:44:27 +01:00
parent 8d39059ce6
commit a223d95912
10 changed files with 344 additions and 30 deletions

2
extern/SafeParcel vendored

@ -1 +1 @@
Subproject commit 4579b940f2aab6bc4be8607b20e0bbb70ab4002d Subproject commit e70516688482e667a22b8d485d1131e5af11c188

View File

@ -19,7 +19,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
} }
} }
@ -27,12 +27,26 @@ buildscript {
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven' apply plugin: 'com.github.dcendents.android-maven'
String getMyVersionName() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always', '--dirty'
standardOutput = stdout
}
return stdout.toString().trim()
}
group = 'org.microg' group = 'org.microg'
version = '1.0-SNAPSHOT' version = getMyVersionName().substring(1)
android { android {
compileSdkVersion 23 compileSdkVersion 23
buildToolsVersion "23.0.2" buildToolsVersion "23.0.2"
defaultConfig {
versionName getMyVersionName()
}
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6 sourceCompatibility JavaVersion.VERSION_1_6
} }

View File

@ -0,0 +1,7 @@
package com.google.android.gms.iid;
import android.os.Message;
interface IMessengerCompat {
void send(in Message message);
}

View File

@ -0,0 +1,59 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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 com.google.android.gms.gcm;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
public class PendingCallback implements Parcelable {
private final IBinder binder;
public PendingCallback(IBinder binder) {
this.binder = binder;
}
private PendingCallback(Parcel in) {
this.binder = in.readStrongBinder();
}
public IBinder getBinder() {
return binder;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStrongBinder(binder);
}
public static final Creator<PendingCallback> CREATOR = new Creator<PendingCallback>() {
@Override
public PendingCallback createFromParcel(Parcel source) {
return new PendingCallback(source);
}
@Override
public PendingCallback[] newArray(int size) {
return new PendingCallback[size];
}
};
}

View File

@ -0,0 +1,106 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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 com.google.android.gms.iid;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
public class MessengerCompat implements Parcelable {
private Messenger messenger;
private IMessengerCompat messengerCompat;
public MessengerCompat(IBinder binder) {
if (SDK_INT >= LOLLIPOP) {
messenger = new Messenger(binder);
} else {
messengerCompat = IMessengerCompat.Stub.asInterface(binder);
}
}
public MessengerCompat(Handler handler) {
if (SDK_INT >= LOLLIPOP) {
messenger = new Messenger(handler);
} else {
messengerCompat = new IMessengerCompatImpl(handler);
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public boolean equals(Object o) {
return o instanceof MessengerCompat && ((MessengerCompat) o).getBinder().equals(getBinder());
}
public IBinder getBinder() {
return messenger != null ? messenger.getBinder() : messengerCompat.asBinder();
}
@Override
public int hashCode() {
return getBinder().hashCode();
}
public void send(Message message) throws RemoteException {
if (messenger != null) messenger.send(message);
else messengerCompat.send(message);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStrongBinder(getBinder());
}
public static final Creator<MessengerCompat> CREATOR = new Creator<MessengerCompat>() {
@Override
public MessengerCompat createFromParcel(Parcel source) {
IBinder binder = source.readStrongBinder();
return binder != null ? new MessengerCompat(binder) : null;
}
@Override
public MessengerCompat[] newArray(int size) {
return new MessengerCompat[size];
}
};
private static class IMessengerCompatImpl extends IMessengerCompat.Stub {
private final Handler handler;
public IMessengerCompatImpl(Handler handler) {
this.handler = handler;
}
@Override
public void send(Message message) throws RemoteException {
message.arg2 = Binder.getCallingUid();
handler.dispatchMessage(message);
}
}
}

View File

@ -0,0 +1,22 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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.microg.gms.auth;
public class AuthConstants {
public static final String DEFAULT_ACCOUNT = "<<default account>>";
public static final String SCOPE_GET_ACCOUNT_ID = "^^_account_id_^^";
}

View File

@ -22,34 +22,8 @@ public class Constants {
* Does not necessarily mean anything. * Does not necessarily mean anything.
*/ */
public static final int MAX_REFERENCE_VERSION = 8489000; public static final int MAX_REFERENCE_VERSION = 8489000;
public static final String KEY_MOCK_LOCATION = "mockLocation";
public static final String DEFAULT_ACCOUNT = "<<default account>>";
public static final String GMS_PACKAGE_NAME = "com.google.android.gms"; public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
public static final String GSF_PACKAGE_NAME = "com.google.android.gsf";
public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788"; public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788";
public static final String SCOPE_GET_ACCOUNT_ID = "^^_account_id_^^";
/**
* No base map tiles.
*/
public static final int MAP_TYPE_NONE = 0;
/**
* Basic maps.
*/
public static final int MAP_TYPE_NORMAL = 1;
/**
* Satellite maps with no labels.
*/
public static final int MAP_TYPE_SATELLITE = 2;
/**
* Terrain maps.
*/
public static final int MAP_TYPE_TERRAIN = 3;
/**
* Satellite maps with a transparent layer of major streets.
*/
public static final int MAP_TYPE_HYBRID = 4;
} }

View File

@ -0,0 +1,71 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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.microg.gms.gcm;
public final class GcmConstants {
public static final String ACTION_C2DM_RECEIVE = "com.google.android.c2dm.intent.RECEIVE";
public static final String ACTION_C2DM_REGISTER = "com.google.android.c2dm.intent.REGISTER";
public static final String ACTION_C2DM_REGISTRATION = "com.google.android.c2dm.intent.REGISTRATION";
public static final String ACTION_C2DM_UNREGISTER = "com.google.android.c2dm.intent.UNREGISTER";
public static final String ACTION_GCM_SEND = "com.google.android.gcm.intent.SEND";
public static final String ACTION_NOTIFICATION_OPEN = "com.google.android.gms.gcm.NOTIFICATION_OPEN";
public static final String ACTION_NOTIFICATION_DISMISS = "com.google.android.gms.gcm.NOTIFICATION_DISMISS";
public static final String ACTION_SCHEDULE = "com.google.android.gms.gcm.ACTION_SCHEDULE";
public static final String ACTION_TASK_READY = "com.google.android.gms.gcm.ACTION_TASK_READY";
public static final String ACTION_TASK_INITIALZE = "com.google.android.gms.gcm.SERVICE_ACTION_INITIALIZE";
public static final String ACTION_INSTANCE_ID = "com.google.android.gms.iid.InstanceID";
public static final String EXTRA_APP = "app";
public static final String EXTRA_COMPONENT = "component";
public static final String EXTRA_DELAY = "google.delay";
public static final String EXTRA_ERROR = "error";
public static final String EXTRA_FROM = "from";
public static final String EXTRA_GSF_INTENT = "GSF";
public static final String EXTRA_PENDING_INTENT = "com.google.android.gms.gcm.PENDING_INTENT";
public static final String EXTRA_MESSENGER = "google.messenger";
public static final String EXTRA_MESSAGE_TYPE = "message_type";
public static final String EXTRA_MESSAGE_ID = "google.message_id";
public static final String EXTRA_REGISTRATION_ID = "registration_id";
public static final String EXTRA_RETRY_AFTER = "Retry-After";
public static final String EXTRA_SCHEDULER_ACTION = "scheduler_action";
public static final String EXTRA_SENDER = "sender";
public static final String EXTRA_SENDER_LEGACY = "legacy.sender";
public static final String EXTRA_SEND_TO = "google.to";
public static final String EXTRA_SEND_FROM = "google.from";
public static final String EXTRA_TAG = "tag";
public static final String EXTRA_TOPIC = "gcm.topic";
public static final String EXTRA_TTL = "google.ttl";
public static final String EXTRA_UNREGISTERED = "unregistered";
public static final String MESSAGE_TYPE_GCM = "gcm";
public static final String MESSAGE_TYPE_DELETED_MESSAGE = "deleted_message";
public static final String MESSAGE_TYPE_SEND_ERROR = "send_error";
public static final String MESSAGE_TYPE_SEND_EVENT = "send_event";
public static final String SCHEDULER_ACTION_CANCEL = "CANCEL_TASK";
public static final String SCHEDULER_ACTION_CANCEL_ALL = "CANCEL_ALL";
public static final String SCHEDULER_ACTION_SCHEDULE = "SCHEDULE_TASK";
public static final String PERMISSION_GTALK = "com.google.android.gtalkservice.permission.GTALK_SERVICE";
public static final String PERMISSION_NETWORK_TASK = "com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE";
public static final String PERMISSION_RECEIVE = "com.google.android.c2dm.permission.RECEIVE";
public static final String PERMISSION_SEND = "com.google.android.c2dm.permission.SEND";
public static final String ERROR_SERVICE_NOT_AVAILABLE = "SERVICE_NOT_AVAILABLE";
public static final String INSTANCE_ID_SCOPE_GCM = "GCM";
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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.microg.gms.location;
public class LocationConstants {
public static final String KEY_MOCK_LOCATION = "mockLocation";
}

View File

@ -0,0 +1,40 @@
/*
* Copyright 2013-2016 microG Project Team
*
* 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.microg.gms.maps;
public class MapsConstants {
/**
* No base map tiles.
*/
public static final int MAP_TYPE_NONE = 0;
/**
* Basic maps.
*/
public static final int MAP_TYPE_NORMAL = 1;
/**
* Satellite maps with no labels.
*/
public static final int MAP_TYPE_SATELLITE = 2;
/**
* Terrain maps.
*/
public static final int MAP_TYPE_TERRAIN = 3;
/**
* Satellite maps with a transparent layer of major streets.
*/
public static final int MAP_TYPE_HYBRID = 4;
}