remove sms permissions from play store variant

and from a new debug variant so that can be tested. Add explanation to
be shown users who try to use the now-unavailable features.
This commit is contained in:
Eric House 2019-01-24 18:39:07 -08:00
parent 88a440acc3
commit a4152239f6
11 changed files with 102 additions and 11 deletions

View file

@ -68,7 +68,7 @@ android {
buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\""
buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true"
resValue "string", "invite_prefix", "/and/"
buildConfigField "String", "GCM_SENDER_ID", "\"\""
buildConfigField "int[]", "SMS_BANNED_EXPL", "null"
}
xw4 {
@ -76,10 +76,12 @@ android {
applicationId "org.eehouse.android.xw4"
manifestPlaceholders = [ APP_ID: applicationId ]
resValue "string", "app_name", "CrossWords"
resValue "string", "nbs_port", "3344"
resValue "string", "nbs_port", "0"
buildConfigField "boolean", "WIDIR_ENABLED", "false"
buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "false"
buildConfigField "String", "VARIANT_NAME", "\"Google Play Store\""
buildConfigField "int[]", "SMS_BANNED_EXPL",
"{R.string.key_notagain_sms_banned, R.string.sms_banned_expl}"
}
xw4fdroid {
@ -103,6 +105,19 @@ android {
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug\""
}
xw4dNoSMS {
dimension "variant"
applicationId "org.eehouse.android.xw4dbg"
manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ]
resValue "string", "app_name", "CrossDbg"
resValue "string", "nbs_port", "3345"
buildConfigField "boolean", "WIDIR_ENABLED", "true"
buildConfigField "boolean", "RELAYINVITE_SUPPORTED", "true"
buildConfigField "String", "VARIANT_NAME", "\"Dev/Debug sans SMS\""
buildConfigField "int[]", "SMS_BANNED_EXPL",
"{R.string.key_notagain_sms_banned, R.string.sms_banned_expl}"
}
// WARNING: "all" breaks things. Seems to be a keyword. Need
// to figure out how to express include-all-abis
// all {
@ -173,6 +188,14 @@ android {
jniLibs.srcDir "../libs-xw4dDebug"
}
}
xw4dNoSMS {
release {
jniLibs.srcDir "../libs-xw4dNoSMSRelease"
}
debug {
jniLibs.srcDir "../libs-xw4dNoSMSDebug"
}
}
xw4fdroid {
release {
jniLibs.srcDir "../libs-xw4fdroidRelease"
@ -213,6 +236,9 @@ dependencies {
xw4dImplementation('com.crashlytics.sdk.android:crashlytics:2.6.3@aar') { // rm-for-fdroid
transitive = true; // rm-for-fdroid
} // rm-for-fdroid
xw4dNoSMSImplementation('com.crashlytics.sdk.android:crashlytics:2.6.3@aar') { // rm-for-fdroid
transitive = true; // rm-for-fdroid
} // rm-for-fdroid
implementation 'com.google.firebase:firebase-messaging:17.3.4' // rm-for-fdroid
implementation 'com.google.firebase:firebase-core:16.0.6' // rm-for-fdroid
@ -294,6 +320,15 @@ afterEvaluate {
"src/xw4d/res/values/strings.xml"
}
preBuild.dependsOn copyStringsTask
String copyStringsTaskNoSMS = "copyStringsXw4DNoSMS"
task "$copyStringsTaskNoSMS"(type: Exec) {
workingDir './'
environment.put('APPNAME', 'CrossDbg')
commandLine 'make', '-f', '../scripts/Variant.mk',
"src/xw4dNoSMS/res/values/strings.xml"
}
preBuild.dependsOn copyStringsTaskNoSMS
}
task makeBuildAssets() {

View file

@ -18,8 +18,6 @@
<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.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

View file

@ -47,14 +47,21 @@ public class Perms23 {
public static enum Perm {
READ_PHONE_STATE(Manifest.permission.READ_PHONE_STATE),
STORAGE(Manifest.permission.WRITE_EXTERNAL_STORAGE),
SEND_SMS(Manifest.permission.SEND_SMS),
RECEIVE_SMS(Manifest.permission.RECEIVE_SMS),
SEND_SMS(Manifest.permission.SEND_SMS, BuildConfig.SMS_BANNED_EXPL),
RECEIVE_SMS(Manifest.permission.RECEIVE_SMS, BuildConfig.SMS_BANNED_EXPL),
READ_CONTACTS(Manifest.permission.READ_CONTACTS);
private String m_str;
private Perm(String str) { m_str = str; }
private int[] m_expl;
private Perm(String str) { this(str, null); }
private Perm(String str, int[] bannedExpl) {
m_str = str;
m_expl = bannedExpl;
}
public String getString() { return m_str; }
public boolean isBanned() { return m_expl != null; }
public int[] getExpl() { Assert.assertTrue(isBanned()); return m_expl; }
public static Perm getFor( String str ) {
Perm result = null;
for ( Perm one : Perm.values() ) {
@ -184,7 +191,27 @@ public class Perms23 {
private void doIt( boolean showRationale )
{
Builder builder = new Builder( m_perms );
Set<Perm> validPerms = new HashSet<>();
Set<Perm> bannedPerms = new HashSet<>();
for ( Perm perm : m_perms ) {
if ( perm.isBanned() ) {
bannedPerms.add( perm );
} else {
validPerms.add( perm );
}
}
if ( 0 < validPerms.size() ) {
doItAsk( validPerms, showRationale );
}
if ( 0 < bannedPerms.size() ) {
doItFail( bannedPerms );
}
}
private void doItAsk( Set<Perm> perms, boolean showRationale )
{
Builder builder = new Builder( perms );
if ( showRationale && null != m_rationaleMsg ) {
builder.setOnShowRationale( new OnShowRationale() {
@Override
@ -222,6 +249,23 @@ public class Perms23 {
} );
}
// Cons up a call with a "no" answer, and post it.
private void doItFail( Set<Perm> bannedPerms )
{
int resID = 0;
final Perm[] perms = bannedPerms.toArray( new Perm[bannedPerms.size()] );
int[] expls = perms[0].getExpl();
m_delegate.makeNotAgainBuilder(expls[1], expls[0]).show();
m_delegate.post( new Runnable() {
@Override
public void run() {
m_delegate.onNegButton( m_action, perms );
}
} );
}
// Post this in case we're called from inside dialog dismiss
// code. Better to unwind the stack...
private void handleButton( final boolean positive )

View file

@ -136,6 +136,7 @@
<string name="key_invite_multi">key_invite_multi</string>
<string name="key_na_rematch_two_only">key_notagain_rematch_two_only</string>
<string name="key_notagain_dfltname">key_notagain_dfltname</string>
<string name="key_notagain_sms_banned">key_notagain_sms_banned</string>
<string name="key_na_comms_bt">key_na_comms_bt</string>
<string name="key_na_comms_p2p">key_na_comms_p2p</string>
<string name="key_na_comms_sms">key_na_comms_sms</string>

View file

@ -2768,4 +2768,12 @@
• Launch CrossWords on the other device\n
• If all else fails, reboot this device\n
</string>
<string name="sms_banned_expl">Play-via-SMS requires Permissions
that most Android apps are no longer allowed to request -- as a
condition of being listed on the Google Play Store. Thus
play-via-SMS no longer works on copies of CrossWords obtained
through the Play Store (as this one was.) If you miss this feature,
please check http://eehouse.org/sms.html for updates on the
situation.</string>
</resources>

View file

@ -6,6 +6,9 @@
<!-- Added for wifi-direct; don't ship until move to 23!!! -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- GooglePlay version no longer allowed to have these (after 9 March 2019) -->
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<!-- for crittercism -->
<uses-permission android:name="android.permission.GET_TASKS"/>

View file

@ -0,0 +1 @@
../../../../../../xw4d/java/org/eehouse/android/xw4/CrashTrack.java

View file

@ -0,0 +1 @@
../../../../../../xw4/java/org/eehouse/android/xw4/FBMService.java

View file

@ -756,7 +756,7 @@ android_debugf( const char* format, ... )
(void)__android_log_write( ANDROID_LOG_DEBUG,
# if defined VARIANT_xw4 || defined VARIANT_xw4fdroid
"xw4"
# elif defined VARIANT_xw4d
# elif defined VARIANT_xw4d || defined VARIANT_xw4dNoSMS
"x4bg"
# endif
, buf );

View file

@ -683,7 +683,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getUUID
#ifdef XWFEATURE_BLUETOOTH
# if defined VARIANT_xw4 || defined VARIANT_xw4fdroid
(*env)->NewStringUTF( env, XW_BT_UUID )
# elif defined VARIANT_xw4d
# elif defined VARIANT_xw4d || defined VARIANT_xw4dNoSMS
(*env)->NewStringUTF( env, XW_BT_UUID_DBG )
# endif
#else

View file

@ -1,6 +1,6 @@
# -*- mode: Makefile; -*-
src/xw4d/res/values/strings.xml: src/main/res/values/strings.xml
src/%/res/values/strings.xml: src/main/res/values/strings.xml
@mkdir -p $(shell dirname $@)
@sed \
-e "s,CrossWords,$(APPNAME),g" \