Skip to content

WaEnhancer Community 0.0.5

Choose a tag to compare

@github-actions github-actions released this 14 Sep 13:47
18a9439

WaEnhancer Community 0.0.5

SHA-256: 709904ab115196f3c780d9412e9286ac496fd0131a8affa34bc765e9ecf0aa45

Changes since v0.0.4.

What's changed

  • #47 Fix late review findings from PRs #45 and #46
  • #48 refactor: stage removal of New XSharedPreferences
  • #49 refactor: remove deprecated New XSharedPreferences metadata
  • #50 fix: unify Freeze Last Seen state across UI controls
  • #51 fix: make runtime diagnostics reflect exercised hooks

Full changelog

This section compiles the descriptions of the pull requests included in this release.

#47 — Fix late review findings from PRs #45 and #46

Merged by contribution from @igorcv88.

Applies the two still-valid Codex review findings left after PRs #44–#46 were merged.

  • PR #45 P2: the direct HideSeen/read-receipt enforcement now preserves VIEW_ONCE_TYPE when the raw incoming message is view-once, matching the existing job/dispatch/protocol paths. Receipt suppression happens before classification so a future classification failure cannot leak a read receipt.
  • PR #46 P1: WhatsApp startup no longer depends on an empty/private XSharedPreferences before the provider fallback exists. DeferredProviderSharedPreferences stays on the legacy store only until FeatureLoader receives the host Application, then hydrates the UID-validated ProviderSharedPreferences before the first startup preference decision (show_hook_toast, Bootloader Spoofer, custom supported versions, bypass_version_check, etc.).

The Android 17 manager fix from PR #46 remains intact: this does not restore MODE_WORLD_READABLE or the global ContextImpl.checkMode() bypass.

CI should validate :app:testWhatsappDebugUnitTest :app:assembleWhatsappDebug before merge.

#48 — refactor: stage removal of New XSharedPreferences

Merged by contribution from @igorcv88.

Objective

Prepare WaEnhancer Community for LSPosed's announced removal of New XSharedPreferences (NSP) without combining this work with the postponed libxposed/resource-hook migration.

This is deliberately Phase 1 of 2. It removes the runtime dependency on XSharedPreferences and stages preference data for a safe metadata transition, but intentionally keeps xposedminversion=93 and xposedsharedprefs=true for this transition build.

Device validation completed

Phase 1 has now been tested on-device:

  • existing WaEnhancer settings remained applied in WhatsApp;
  • changing settings in the WaEnhancer app propagated to WhatsApp normally;
  • no behavioral regression was noticed during random preference toggles;
  • the staged migration snapshot was confirmed at /data/user/0/com.waenhancer.community/files/nsp_preferences_v1.json (about 16 KB).

This validates the provider-only runtime path and confirms that the Phase-2 restore source exists on the tested installation.

Why this is staged

LSPosed's NSP mode redirects the module's SharedPreferences directory. Simply removing xposedsharedprefs / lowering xposedminversion in the same build would make existing public and private stores move back to the normal app data directory and can make an existing installation appear to have lost its settings.

Users must therefore run a Phase-1 build at least once before Phase 2 removes the NSP metadata.

Phase 1 changes

  • runtime WhatsApp preferences now use the existing UID-validated HookProvider / ProviderSharedPreferences bridge as the authoritative path
  • WppXposed no longer constructs or reads XSharedPreferences
  • DeferredProviderSharedPreferences no longer requires an XSP fallback; it returns defaults only before the host Application exists and hydrates from the provider once FeatureLoader.mApp is available
  • XPrefManager no longer reflectively creates XSharedPreferences
  • Feature.reloadPrefs() is transport-agnostic
  • removed the unused preference parameter from the system-server downgrade patch
  • added NspPreferenceMigration, which captures typed copies of both public and private preference stores into filesDir/nsp_preferences_v1.json
  • the snapshot is refreshed after preference changes and kept outside the redirected SharedPreferences directory
  • future restore is wired into both Application.onCreate() and HookProvider.onCreate() so the first post-NSP provider request cannot observe an empty store
  • after a successful Phase-2 restore, the snapshot is deleted because it can contain private-store secrets

Intentionally unchanged in this PR

  • xposedminversion remains 93
  • xposedsharedprefs remains true
  • legacy Xposed entrypoints remain unchanged
  • IXposedHookInitPackageResources / resource hooks remain unchanged
  • no libxposed API 101/102 migration

Therefore the LSPosed deprecation banner is expected to remain for this Phase-1 build.

Phase 2

A separate stacked branch/PR performs the metadata cut only after this validated Phase-1 state:

  1. set xposedminversion=82
  2. remove xposedsharedprefs
  3. restore the staged snapshot into normal app-private SharedPreferences on first start
  4. verify the LSPosed deprecation banner disappears while legacy/resource hooks remain untouched

Build checks

./gradlew :app:testWhatsappDebugUnitTest :app:assembleWhatsappDebug

Do not merge Phase 2 into this PR. Keeping the metadata transition separate is the rollback/data-preservation boundary.

#49 — refactor: remove deprecated New XSharedPreferences metadata

Merged by contribution from @igorcv88.

Objective

Complete Phase 2 of the staged New XSharedPreferences (NSP) removal after Phase 1 was merged and validated on-device.

Device validation from Phase 1

The merged Phase-1 build was installed over the existing module and verified to keep all previously applied settings working. Random preference changes in the WaEnhancer app propagated to WhatsApp normally, with no observed behavioral regression. The migration snapshot was also confirmed at:

/data/user/0/com.waenhancer.community/files/nsp_preferences_v1.json

with a size of about 16 KB.

That means the provider-only runtime preference path and the migration source are both present on the tested installation.

Phase 2 change

This PR intentionally contains only the LSPosed metadata cut:

  • xposedminversion: 93 -> 82
  • remove xposedsharedprefs=true

No resource hooks, legacy entrypoints, Xposed method hooks, libxposed APIs, Gradle configuration, or application logic are changed in this PR.

Why the change is now safe

Phase 1 already moved runtime preference transport to the UID-validated HookProvider / ProviderSharedPreferences path and stopped WppXposed, XPrefManager, and the deferred runtime wrapper from constructing XSharedPreferences.

NspPreferenceMigration stores the previous NSP-backed public/private preference state in filesDir, which is outside the redirected SharedPreferences directory. With NSP no longer declared, startup detects the transition and restores that staged snapshot into the normal app-private SharedPreferences stores. Restore is wired through both HookProvider.onCreate() and Application.onCreate() so the first post-upgrade access cannot observe an empty provider store merely because WhatsApp starts before the companion app.

Intentionally not included

There are a couple of legacy compatibility checks elsewhere that reference the old XSharedPreferences class with instanceof. They are no longer the active preference transport. They are left untouched here because XSharedPreferences itself belongs to the old legacy Xposed API (including API 82); the feature LSPosed is deprecating is the New XSharedPreferences semantics/metadata, not the existence of every legacy class reference. Keeping this PR to the metadata cut makes any runtime regression attributable and reversible.

Expected result

  • existing settings survive the first upgrade from the Phase-1 build;
  • runtime preference reads/writes continue through the provider bridge;
  • module remains a legacy Xposed module;
  • IXposedHookInitPackageResources behavior is unchanged;
  • the LSPosed "uses features that will be deprecated" banner should disappear if the support-channel guidance is correctly understood.

Required device validation

  1. Install this Phase-2 APK over the already-tested Phase-1 build.
  2. Open WhatsApp and confirm existing WaEnhancer settings are still active.
  3. Open the WaEnhancer manager and confirm saved values are still present.
  4. Change a manager setting and verify WhatsApp receives it.
  5. Change an embedded WhatsApp WaEnhancer setting and verify it persists back to the manager.
  6. Restart WhatsApp and re-check behavior.
  7. Confirm the LSPosed deprecation banner disappears while the module is still labeled legacy.
  8. Re-check any private/provider-backed feature you use, especially Tasker/secrets/Bootloader Spoofer.

After a successful restore, the staged snapshot is deleted by the migration helper because it can contain data from the private store.

CI

./gradlew :app:testWhatsappDebugUnitTest :app:assembleWhatsappDebug

#50 — fix: unify Freeze Last Seen state across UI controls

Merged by contribution from @igorcv88.

Problem

Freeze Last Seen had two independent state keys:

  • freezelastseen in the Companion / embedded settings
  • freeze_last_seen_actual in the WhatsApp home menu and Quick Settings tile

The runtime hook accepted either key, but the home-menu key is not part of the provider-backed preference schema. After the provider-only preference migration, toggling Freeze Last Seen from the WhatsApp menu could appear to work until restart and then return to OFF. Enabling freezelastseen from the Companion also caused show_freezeLastSeen to be disabled and automatically unchecked, so the WhatsApp menu item disappeared.

Fix

  • use freezelastseen as the single Freeze Last Seen state key in the hook, WhatsApp home menu and Quick Settings tile
  • keep show_freezeLastSeen exclusively as the display-control preference
  • preserve the checked value of show_freezeLastSeen while it is temporarily disabled by the active Freeze Last Seen dependency, instead of clearing it
  • apply the same display-toggle behavior in both Companion and embedded WhatsApp settings
  • remove obsolete direct freeze_last_seen_actual handling from the Freeze Last Seen hook

Expected behavior

With Show Freeze Last Seen Button enabled:

  1. menu shows Freeze Last Seen (OFF) while the feature is off
  2. toggling it from WhatsApp persists freezelastseen=true, restarts WhatsApp, and the menu returns as ON
  3. toggling it off returns the same menu item as OFF
  4. enabling/disabling Freeze Last Seen in the Companion is reflected by the WhatsApp menu after restart
  5. the Quick Settings tile reflects and changes the same state

Ghost Mode behavior remains able to activate the Freeze Last Seen hook independently as before.

Validation

Run:

./gradlew :app:testWhatsappDebugUnitTest :app:assembleWhatsappDebug

Device smoke test should cover Companion -> menu, menu -> Companion, ON -> OFF, OFF -> ON, restart persistence, embedded settings, and the Freeze Last Seen Quick Settings tile.

#51 — fix: make runtime diagnostics reflect exercised hooks

Merged by contribution from @igorcv88.

Problem

The functional diagnostics/validation screen was effectively static even when hooks were visibly working on-device.

The root causes were infrastructure bugs rather than user testing:

  1. RuntimeDiagnostics.initialize(...) existed but was never called, so snapshots never received the host package/version, module version or Xposed API identity that ValidationSession requires.
  2. HostCompatibility.probe() produced the authoritative probeDefinitive=true result, but no runtime path ever called it. ValidationSession.isCurrentSnapshot() therefore rejected every snapshot as non-current.
  3. normal feature loaded events were kept only in the in-process JSON because RuntimeDiagnostics.feature() persisted only triggered/error events.
  4. the validation model treated missing resolverPassed bookkeeping as RESOLVER_FAILED and required loaded + installed + triggered for required features, even though the normal non-lazy FeatureLoader never records resolverPassed/installed the way the lazy FeatureRegistry does.
  5. only a few features actually emitted diagnosticTriggered(). In particular, ViewOnce and FreezeLastSeen could never become TRIGGERED regardless of how often they were exercised.

Fix

  • initialize the runtime snapshot exactly once from the first normal Feature construction, after DexKit is available
  • run the authoritative semantic HostCompatibility.probe() once and record unexpected probe failures explicitly instead of leaving a blank/non-definitive snapshot
  • debounce/persist all runtime evidence, including loaded, so the Companion can actually observe it without synchronous Binder I/O on hook hot paths
  • treat a real callback execution as stronger evidence than optional installation bookkeeping: a hook that actually fires is reported as TRIGGERED even if the normal loader did not emit resolverPassed/installed
  • distinguish an explicit resolverFailed event from merely absent resolver metadata
  • instrument the real effect paths for:
    • ViewOnce — records only when the hook actually changes an incoming view-once state
    • FreezeLastSeen — records when the replacement callback actually suppresses the host last-seen update
  • show runtime snapshot age in the report so it is visible whether new evidence is reaching the Companion
  • extend ValidationModelTest for callback-authoritative evidence and explicit resolver failures

Existing callback diagnostics for HideSeen, AntiRevoke, and DownloadViewOnce are preserved and now have a valid/persisted runtime snapshot to write into.

Semantics

This does not mark every feature validated automatically.

  • NOT_EXERCISED means there is no real callback evidence yet.
  • TRIGGERED means an instrumented hook callback actually executed during the active validation session.
  • manual behavior confirmation remains separate where required.
  • missing bookkeeping is no longer mislabeled as resolver failure.
  • actual probe/resolver failures remain failures.

Device validation

After installing this build and restarting WhatsApp:

  1. open Diagnostics and start a WhatsApp validation session;
  2. exercise View Once -> ViewOnce should become TRIGGERED;
  3. save view-once media -> DownloadViewOnce should become TRIGGERED;
  4. enable/use Freeze Last Seen -> FreezeLastSeen should become TRIGGERED;
  5. exercise Hide Seen / Anti-Revoke as applicable -> their existing callback evidence should update;
  6. verify Runtime snapshot age changes after runtime events;
  7. only tick manual behavior confirmation after observing the expected behavior.

Untested hooks should remain NOT_EXERCISED.

Stacking

This PR is intentionally stacked on fix/freeze-last-seen-state / PR #50 because the Freeze Last Seen diagnostic callback is applied on top of the canonical freezelastseen state fix. Retarget to master after #50 merges.

CI

./gradlew :app:testWhatsappDebugUnitTest :app:assembleWhatsappDebug