Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ steps:
- wait

- label: ":hammer_and_pick: Build and Test"
command: ./gradlew --stacktrace testRelease
command: ./gradlew --stacktrace testReleaseTest
plugins: [$CI_TOOLKIT_PLUGIN]
notify:
- github_commit_status:
Expand Down
15 changes: 10 additions & 5 deletions PasscodeLock/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {

android {
namespace 'org.wordpress.passcodelock'
compileSdk 34
compileSdk 36

defaultConfig {
minSdk 23
Expand All @@ -26,16 +26,21 @@ android {
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
releaseTest {
initWith release
minifyEnabled false
shrinkResources false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to create a different task to run tests on Release with minify disabled, since otherwise there was a ClassDefNotFound error on the AbstractAppLock class, and R8 was stripping the PasscodeLock classes. Kudos to Claude Code for helping me out on this one, see 8c792b4

}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'androidx.preference:preference:1.2.1'
}

android.buildTypes.all { buildType ->
Expand Down
4 changes: 4 additions & 0 deletions PasscodeLock/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Consumer ProGuard rules for PasscodeLock module
# These rules are automatically applied to consumers of this module
-keep class org.wordpress.passcodelock.** { *; }
-dontwarn org.wordpress.passcodelock.**
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.passcodelock;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
Expand All @@ -24,9 +25,11 @@ public abstract class AbstractPasscodeKeyboardActivity extends Activity {
protected InputFilter[] filters = null;
protected TextView topMessage = null;

@SuppressLint("RestrictedApi")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to avoid linter complaining for now, but tracking separately here #1734

protected FingerprintManagerCompat mFingerprintManager;
protected CancellationSignal mCancel;

@SuppressLint("RestrictedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -36,21 +39,21 @@ protected void onCreate(Bundle savedInstanceState) {
}

setContentView(R.layout.app_passcode_keyboard);

topMessage = (TextView) findViewById(R.id.passcodelock_prompt);

Bundle extras = getIntent().getExtras();
if (extras != null) {
String message = extras.getString(KEY_MESSAGE);
if (message != null) {
topMessage.setText(message);
}
}

filters = new InputFilter[2];
filters[0]= new InputFilter.LengthFilter(1);
filters[1] = onlyNumber;

mPinCodeField = (EditText)findViewById(R.id.pin_field);

//setup the keyboard
Expand Down Expand Up @@ -158,8 +161,9 @@ public void run() {
protected void showPasswordError(){
Toast.makeText(AbstractPasscodeKeyboardActivity.this, R.string.passcode_wrong_passcode, Toast.LENGTH_SHORT).show();
}

protected abstract void onPinLockInserted();
@SuppressLint("RestrictedApi")
protected abstract FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback();

private InputFilter onlyNumber = new InputFilter() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.wordpress.passcodelock;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
Expand All @@ -23,7 +24,8 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

@Override
@SuppressLint("RestrictedApi")
@Override
public void onResume() {
super.onResume();

Expand Down Expand Up @@ -73,13 +75,14 @@ protected void onPinLockInserted() {
type = PasscodePreferenceFragment.ENABLE_PASSLOCK;
} else {
authenticationFailed();
}
}
break;
default:
break;
}
}

@SuppressLint("RestrictedApi")
@Override
protected FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback() {
return new FingerprintManagerCompat.AuthenticationCallback() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.wordpress.passcodelock;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.view.View;

import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
import androidx.core.os.CancellationSignal;

public class PasscodeUnlockActivity extends AbstractPasscodeKeyboardActivity {
@SuppressLint("RestrictedApi")
@Override
public void onResume() {
super.onResume();
Expand Down Expand Up @@ -39,6 +41,7 @@ protected void onPinLockInserted() {
}
}

@SuppressLint("RestrictedApi")
@Override
protected FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback() {
return new FingerprintManagerCompat.AuthenticationCallback() {
Expand All @@ -59,6 +62,7 @@ public void onAuthenticationFailed() {
};
}

@SuppressLint("RestrictedApi")
private boolean isFingerprintSupportedAndEnabled() {
return mFingerprintManager.isHardwareDetected() &&
mFingerprintManager.hasEnrolledFingerprints() &&
Expand Down
73 changes: 40 additions & 33 deletions Simplenote/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def versionProperties = loadPropertiesFromFile(file("${rootDir}/version.properti

android {
namespace 'com.automattic.simplenote'
compileSdk 34
compileSdk 36

buildTypes {
debug {
Expand All @@ -21,6 +21,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

// New build type for CI testing without minification to avoid ClassNotFoundException
releaseTest {
initWith release
minifyEnabled false
shrinkResources false
}

// Dedicated build type for screenshots so that we can add the special
// permissions only to it, keeping debug and release closer together to
// make bug hunting easier.
Expand All @@ -46,9 +53,6 @@ android {
testInstrumentationRunner 'com.automattic.simplenote.SimplenoteAppRunner'
}

lintOptions {
checkReleaseBuilds false
}

testOptions {
unitTests.returnDefaultValues = true
Expand All @@ -59,16 +63,19 @@ android {

// Target Java8 to avoid use certain Kotlin's features
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}

viewBinding {
enabled = true
}
lint {
checkReleaseBuilds false
}
}

buildscript {
Expand All @@ -83,26 +90,26 @@ buildscript {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:4.0.0'
testImplementation 'org.mockito:mockito-inline:4.0.0'
androidTestImplementation 'androidx.test:core:1.3.0'
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0') {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.18.0'
testImplementation 'org.mockito:mockito-inline:5.2.0'
androidTestImplementation 'androidx.test:core:1.7.0'
androidTestImplementation 'androidx.annotation:annotation:1.9.1'
androidTestImplementation 'androidx.test:runner:1.7.0'
androidTestImplementation 'androidx.test:rules:1.7.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.7.0'
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.7.0') {
// Necessary to avoid version conflicts
exclude group: 'androidx', module: 'appcompat'
exclude group: 'androidx', module: 'support-v4'
exclude group: 'androidx', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
// Infrastructure to test fragments
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.3"
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
testImplementation "androidx.arch.core:core-testing:2.2.0"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2"
testImplementation "org.mockito.kotlin:mockito-kotlin:6.0.0"


// Support for JsonObjects in unit tests since they are used by BucketObjects
Expand All @@ -116,32 +123,32 @@ dependencies {
implementation "com.automattic.tracks:crashlogging:$automatticTracksVersion"

// Kotlin's coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2'

// Google Support
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.vectordrawable:vectordrawable:1.2.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'androidx.concurrent:concurrent-futures:1.1.0'
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation 'androidx.work:work-runtime:2.10.3'
implementation 'androidx.concurrent:concurrent-futures:1.3.0'
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
implementation "androidx.multidex:multidex:2.0.1"
// Support for ViewModels and LiveData
implementation "androidx.activity:activity-ktx:1.3.1"
implementation "androidx.fragment:fragment-ktx:1.3.6"
implementation "androidx.activity:activity-ktx:1.10.1"
implementation "androidx.fragment:fragment-ktx:1.8.8"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidxLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$androidxLifecycleVersion"
// Support for androidx Fragments
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$androidxLifecycleVersion"

// Google Play Services
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
implementation 'com.google.android.gms:play-services-wearable:19.0.0'
// Third Party
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp3:okhttp:5.1.0'
implementation 'com.commonsware.cwac:anddown:0.4.0'
implementation 'net.openid:appauth:0.7.0'
implementation 'net.openid:appauth:0.11.1'

// Dagger Hilt dependencies
implementation "com.google.dagger:hilt-android:$google_dagger"
Expand Down
14 changes: 14 additions & 0 deletions Simplenote/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,17 @@

# AndroidAsync lib compiles these classes
-dontwarn org.bouncycastle.**

# PasscodeLock classes - needed for tests that trigger analytics which instantiate AppLock
-keep class org.wordpress.passcodelock.** { *; }
-dontwarn org.wordpress.passcodelock.**

# Keep specific classes that are failing in tests
-keep class org.wordpress.passcodelock.AbstractAppLock { *; }
-keep class org.wordpress.passcodelock.DefaultAppLock { *; }
-keep class org.wordpress.passcodelock.AppLockManager { *; }

# Keep the SimplenoteAppLock and related analytics classes
-keep class com.automattic.simplenote.SimplenoteAppLock { *; }
-keep class com.automattic.simplenote.analytics.** { *; }
-keep class com.automattic.simplenote.Simplenote { *; }
13 changes: 7 additions & 6 deletions Simplenote/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@
</activity>

<activity
android:name=".NotesActivity"
android:name="com.automattic.simplenote.NotesActivity"
android:configChanges="screenSize|smallestScreenSize|orientation|screenLayout"
android:label="@string/app_launcher_name"
android:resizeableActivity="true"
android:exported="true"
android:windowSoftInputMode="adjustResize|stateHidden">
android:windowSoftInputMode="adjustResize|stateHidden"
android:theme="@style/Theme.Simplestyle">

<intent-filter>

Expand Down Expand Up @@ -85,7 +86,7 @@

<data
android:host="app.simplenote.com"
android:pathPattern="/account/.*/reset?redirect=simplenote://launch"
android:pathPattern="/account/.*/reset"
android:scheme="https">
</data>

Expand Down Expand Up @@ -121,7 +122,7 @@
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="app.simplenote.com"
android:pathPattern="/account/.*/reset?redirect=simplenote://launch"
android:pathPattern="/account/.*/reset"
android:scheme="https">
</data>
</intent-filter>
Expand Down Expand Up @@ -180,11 +181,11 @@
<activity
android:name="com.automattic.simplenote.StyleActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName=".PreferencesActivity"></activity>
android:parentActivityName=".PreferencesActivity" />

<activity
android:name="com.automattic.simplenote.TagsActivity"
android:configChanges="orientation|keyboardHidden|screenSize"></activity>
android:configChanges="orientation|keyboardHidden|screenSize" />

<activity
android:name="com.automattic.simplenote.DeepLinkActivity"
Expand Down
Loading