merge in changes from the -gcm directory: GCM will be a feature of the

non-variant build now.
This commit is contained in:
Eric House 2012-11-02 05:35:31 -07:00
parent e66ddc3765
commit 47f9eb03b9
14 changed files with 45 additions and 514 deletions

View file

@ -1,187 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- -*- compile-command: "ant install"; -*- -->
<!-- Copyright (C) 2007 The Android Open Source 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.
-->
<!-- Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package
supplies a unique name for the application. When writing your
own application, the package name must be changed from "com.example.*"
to come from a domain that you own or have control over. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.eehouse.android.xw4gcm"
android:versionCode="44"
android:versionName="@string/app_version"
>
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- GCM stuff -->
<permission android:name="org.eehouse.android.xw4gcm.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="org.eehouse.android.xw4gcm.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:icon="@drawable/icon48x48"
android:label="@string/app_name"
android:name=".XWApp"
>
<activity android:name="GamesList"
android:label="@string/app_name"
android:launchMode="standard"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="DictsActivity"
android:label="@string/title_dicts_list"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="NewGameActivity"
android:theme="@android:style/Theme.NoTitleBar"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="SMSInviteActivity"
android:theme="@android:style/Theme.Dialog"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
/>
<activity android:name="GameConfig"
android:screenOrientation="sensor"
android:configChanges="keyboardHidden|orientation"
>
<intent-filter>
<action android:name="android.intent.action.EDIT" />
</intent-filter>
</activity>
<activity android:name="PrefsActivity"
android:label="@string/title_prefs"
android:screenOrientation="sensor"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="BoardActivity"
android:theme="@android:style/Theme.Light"
android:screenOrientation="portrait"
android:configChanges="keyboardHidden"
/>
<activity android:name="LookupActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.Dialog"
/>
<receiver android:name="RelayReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<receiver android:name="UpdateCheckReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<activity android:name="DispatchNotify"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="newxwgame"/>
</intent-filter>
</activity>
<!-- downloading dicts -->
<activity android:name=".DictImportActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="file" android:host="*"
android:pathPattern=".*\\.xwd" />
<data android:scheme="http"
android:mimeType="application/x-xwordsdict"
android:host="*"
android:pathPattern=".*\\.xwd" />
</intent-filter>
</activity>
<activity android:name="RelayGameActivity"/>
<activity android:name="DictBrowseActivity"
android:configChanges="keyboardHidden|orientation"
/>
<activity android:name="ChatActivity"
android:configChanges="keyboardHidden|orientation"
/>
<service android:name="RelayService"/>
<receiver android:name=".MountEventReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<data android:scheme="file" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MEDIA_EJECT" />
<data android:scheme="file" />
</intent-filter>
</receiver>
<receiver android:name="SMSReceiver" >
<intent-filter android:priority="999" >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<service android:name="SMSService"/>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="org.eehouse.android.xw4gcm" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>

View file

@ -1,126 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="XWords4" default="release">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>
<target name="-pre-clean">
<exec dir="." executable="../scripts/ndkbuild.sh" output="/dev/null">
<arg value="clean"/>
</exec>
<exec dir="." executable="../scripts/cleanvariants.sh" >
<arg value="--dest-dir"/>
<arg value="./res"/>
<arg value="--dest-dir"/>
<arg value="./src"/>
<arg value="--dest-dir"/>
<arg value="./jni"/>
<arg value="--dest-dir"/>
<arg value="./assets"/>
</exec>
</target>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<target name="-pre-build">
<exec dir="." executable="../scripts/mkvariant.sh" output="/dev/null">
<arg value="--variant-name"/>
<arg value="xw4gcm"/>
<arg value="--app-name"/>
<arg value="cWords-gcm"/>
<arg value="--dest-dir"/>
<arg value="./res"/>
<arg value="--dest-dir"/>
<arg value="./src"/>
<arg value="--dest-dir"/>
<arg value="./jni"/>
<arg value="--dest-dir"/>
<arg value="./assets"/>
</exec>
<exec dir="." executable="../scripts/gen_gcmid.sh"
output="src/org/eehouse/android/xw4gcm/GCMConsts.java"
/>
<exec dir="." executable="../scripts/ndkbuild.sh" >
<arg value="-j3"/>
</exec>
<exec dir=".." executable="./scripts/genvers.sh" output="/dev/null">
<arg value="XWords4-gcm"/>
<arg value="xw4gcm"/>
</exec>
</target>
<!--
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View file

@ -1,86 +0,0 @@
# -*- mode: Makefile; compile-command: "cd ../; ${NDK_ROOT}/ndk-build -j3"; -*-
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
COMMON_PATH=../../../common
local_C_INCLUDES+= \
-I$(LOCAL_PATH)/$(COMMON_PATH) \
-I$(LOCAL_PATH)/../../../relay \
local_LDLIBS += -llog
# local_DEBUG = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING
local_DEFINES += \
$(local_DEBUG) \
-DXWFEATURE_RELAY \
-DXWFEATURE_SMS \
-DXWFEATURE_COMMSACK \
-DXWFEATURE_TURNCHANGENOTIFY \
-DXWFEATURE_CHAT \
-DCOMMS_XPORT_FLAGSPROC \
-DKEY_SUPPORT \
-DXWFEATURE_CROSSHAIRS \
-DPOINTER_SUPPORT \
-DSCROLL_DRAG_THRESHHOLD=1 \
-DDROP_BITMAPS \
-DXWFEATURE_TRAYUNDO_ONE \
-DDISABLE_TILE_SEL \
-DXWFEATURE_BOARDWORDS \
-DXWFEATURE_WALKDICT \
-DXWFEATURE_WALKDICT_FILTER \
-DXWFEATURE_DICTSANITY \
-DFEATURE_TRAY_EDIT \
-DXWFEATURE_BONUSALL \
-DMAX_ROWS=32 \
-DHASH_STREAM \
-DXWFEATURE_BASE64 \
-DXWFEATURE_DEVID \
-DINITIAL_CLIENT_VERS=2 \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \
# -DXWFEATURE_SCOREONEPASS \
local_SRC_FILES += \
xwjni.c \
utilwrapper.c \
drawwrapper.c \
xportwrapper.c \
anddict.c \
andutils.c \
jniutlswrapper.c \
COMMON_PATH=../../../common
common_SRC_FILES += \
$(COMMON_PATH)/boarddrw.c \
$(COMMON_PATH)/scorebdp.c \
$(COMMON_PATH)/dragdrpp.c \
$(COMMON_PATH)/pool.c \
$(COMMON_PATH)/tray.c \
$(COMMON_PATH)/dictnry.c \
$(COMMON_PATH)/dictiter.c \
$(COMMON_PATH)/mscore.c \
$(COMMON_PATH)/vtabmgr.c \
$(COMMON_PATH)/strutils.c \
$(COMMON_PATH)/engine.c \
$(COMMON_PATH)/board.c \
$(COMMON_PATH)/mempool.c \
$(COMMON_PATH)/game.c \
$(COMMON_PATH)/server.c \
$(COMMON_PATH)/model.c \
$(COMMON_PATH)/comms.c \
$(COMMON_PATH)/memstream.c \
$(COMMON_PATH)/movestak.c \
$(COMMON_PATH)/dbgutil.c \
LOCAL_CFLAGS+=$(local_C_INCLUDES) $(local_DEFINES) -Wall
LOCAL_SRC_FILES := $(linux_SRC_FILES) $(local_SRC_FILES) $(common_SRC_FILES)
LOCAL_MODULE := xwjni
LOCAL_LDLIBS := -L${SYSROOT}/usr/lib -llog -lz
include $(BUILD_SHARED_LIBRARY)

View file

@ -1,11 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-7

View file

@ -1,85 +0,0 @@
/* -*- compile-command: "cd ../../../../../; ant debug install"; -*- */
/*
* Copyright 2010 - 2011 by Eric House (xwords@eehouse.org). All
* rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4gcm;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import java.util.UUID;
import org.eehouse.android.xw4gcm.jni.XwJNI;
public class XWApp extends Application {
public static final boolean DEBUG_LOCKS = false;
public static final boolean BTSUPPORTED = false;
public static final boolean SMSSUPPORTED = true;
public static final boolean GCMSUPPORTED = true;
public static final boolean DEBUG = true;
public static final String SMS_PUBLIC_HEADER = "-XW4g";
private static UUID s_UUID = null;
private static Boolean s_onEmulator = null;
@Override
public void onCreate()
{
super.onCreate();
// This one line should always get logged even if logging is
// off -- because logging is on by default until logEnable is
// called.
DbgUtils.logf( "XWApp.onCreate(); git_rev=%s",
getString( R.string.git_rev ) );
DbgUtils.logEnable( this );
ConnStatusHandler.loadState( this );
RelayReceiver.RestartTimer( this );
UpdateCheckReceiver.restartTimer( this );
BTService.startService( this );
SMSService.checkForInvites( this );
GCMIntentService.init( this );
}
public static UUID getAppUUID()
{
if ( null == s_UUID ) {
s_UUID = UUID.fromString( XwJNI.comms_getUUID() );
}
return s_UUID;
}
public static String getAppName( Context context )
{
return context.getString( R.string.app_name );
}
public static boolean onEmulator()
{
if ( null == s_onEmulator ) {
s_onEmulator = new Boolean( "google_sdk".equals(Build.MODEL) );
}
return s_onEmulator;
}
}

View file

@ -36,7 +36,13 @@
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
<!-- GCM stuff -->
<permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:icon="@drawable/icon48x48"
android:label="@string/app_name"
@ -164,5 +170,16 @@
<service android:name="SMSService"/>
<receiver android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="org.eehouse.android.xw4" />
</intent-filter>
</receiver>
<service android:name=".GCMIntentService" />
</application>
</manifest>

View file

@ -59,6 +59,9 @@
<exec dir="." executable="../scripts/ndkbuild.sh" >
<arg value="-j3"/>
</exec>
<exec dir="." executable="../scripts/gen_gcmid.sh"
output="src/org/eehouse/android/xw4/GCMConsts.java"
/>
<exec dir=".." executable="./scripts/genvers.sh" output="ant_out.txt">
<arg value="XWords4"/>
<arg value="xw4"/>

View file

@ -35,6 +35,7 @@ local_DEFINES += \
-DMAX_ROWS=32 \
-DHASH_STREAM \
-DXWFEATURE_BASE64 \
-DXWFEATURE_DEVID \
-DINITIAL_CLIENT_VERS=2 \
-DRELAY_ROOM_DEFAULT=\"\" \
-D__LITTLE_ENDIAN \

View file

@ -552,6 +552,7 @@ static const XP_UCHAR*
and_util_getDevID( XW_UtilCtxt* uc, DevIDType* typ )
{
const XP_UCHAR* result = NULL;
*typ = ID_TYPE_ANDROID_GCM;
UTIL_CBK_HEADER( "getDevID", "()Ljava/lang/String;" );
jstring jresult = (*env)->CallObjectMethod( env, util->jutil, mid );
if ( NULL != jresult ) {
@ -568,9 +569,7 @@ and_util_getDevID( XW_UtilCtxt* uc, DevIDType* typ )
util->devIDStorage[len] = '\0';
}
(*env)->ReleaseStringUTFChars( env, jresult, jchars );
result = (const XP_UCHAR*)util->devIDStorage;
*typ = ID_TYPE_ANDROID_GCM;
}
UTIL_CBK_TAIL();
return result;

View file

@ -1 +1,2 @@
GitVersion.java
GCMConsts.java

View file

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.eehouse.android.xw4gcm;
package org.eehouse.android.xw4;
import android.app.Application;
import android.content.Context;
@ -58,20 +58,23 @@ public class GCMIntentService extends GCMBaseIntentService {
public static void init( Application app )
{
DbgUtils.logf( "GCMIntentService.init()" );
GCMRegistrar.checkDevice( app );
GCMRegistrar.checkManifest( app );
final String regId = GCMRegistrar.getRegistrationId( app );
if (regId.equals("")) {
DbgUtils.logf( "registering..." );
GCMRegistrar.register( app, GCMConsts.SENDER_ID );
} else {
DbgUtils.logf( "Already registered: id=\"%s\"", regId );
}
int sdkVersion = Integer.valueOf(android.os.Build.VERSION.SDK);
if ( 8 <= sdkVersion ) {
GCMRegistrar.checkDevice( app );
GCMRegistrar.checkManifest( app );
final String regId = GCMRegistrar.getRegistrationId( app );
if (regId.equals("")) {
DbgUtils.logf( "registering..." );
GCMRegistrar.register( app, GCMConsts.SENDER_ID );
} else {
DbgUtils.logf( "Already registered: id=\"%s\"", regId );
}
String curID = XWPrefs.getGCMDevID( app );
if ( ! curID.equals( regId ) ) {
DbgUtils.logf( "saved bad id: %s", curID );
XWPrefs.setGCMDevID( app, regId );
String curID = XWPrefs.getGCMDevID( app );
if ( ! curID.equals( regId ) ) {
DbgUtils.logf( "saved bad id: %s", curID );
XWPrefs.setGCMDevID( app, regId );
}
}
}

View file

@ -31,7 +31,7 @@ public class XWApp extends Application {
public static final boolean DEBUG_LOCKS = false;
public static final boolean BTSUPPORTED = false;
public static final boolean SMSSUPPORTED = true;
public static final boolean GCMSUPPORTED = false;
public static final boolean GCMSUPPORTED = true;
public static final boolean DEBUG = false;
public static final String SMS_PUBLIC_HEADER = "-XW4";
@ -58,6 +58,8 @@ public class XWApp extends Application {
BTService.startService( this );
SMSService.checkForInvites( this );
GCMIntentService.init( this );
}
public static UUID getAppUUID()

View file

@ -8,7 +8,7 @@ fi
cat <<EOF
// Auto-generated: DO NOT CHECK THIS IN until questions about
// obscuring the id are cleared up
package org.eehouse.android.xw4gcm;
package org.eehouse.android.xw4;
public class GCMConsts {
public static final String SENDER_ID = "${GCM_SENDER_ID}";