AndroidAPK ModdingReverse Engineering

Porting the OnePlus Clock to ColorOScom.oneplus.deskclock on a Find X9 Pro

A re-signed build of the OnePlus 15's clock that installs next to Oppo's own on a Find X9 Pro instead of replacing it. Both are OPPO-family builds of the same codebase, so getting a second copy onto the device is mostly a matter of renaming the authorities, permissions and content URIs the two apps share. Renaming doesn't fix weather, though: the widgets draw, but the temperature never fills, because the weather service checks the signing certificate of whoever is asking and a rebuild doesn't have one it accepts.

Base

OxygenOS 16.19.4

com.oneplus.deskclock, from a OnePlus 15

Device

Find X9 Pro

ColorOS 16, CPH2791

Change set

16 files

9 authorities and 7 permissions renamed, 39 strings in smali

Weather widgets

8 of 9

They draw. The temperature never fills.

Table of contents

What it is

The OnePlus 15's clock app installs on a Find X9 Pro and runs next to Oppo's own clock rather than replacing it. Both are OPPO-family builds of the same codebase, so their package names already differ: com.oneplus.deskclock against com.coloros.alarmclock. The conflict is in the internal identity strings underneath, and once those are renamed both apps sit on the device at once.

Oppo's stock clock lives at /product/app/Clock/Clock.apk. A third name, com.oplus.alarmclock, isn't installed at all (it's only what the OnePlus APK's <original-package> tag points at).

The clock itself works. The weather widgets draw normally but never show a temperature, and there's nothing you can edit in the APK that changes that.

Why the package name stays the same

The usual way to install a modified system app without root is to rename its package, so Android registers it as a distinct app rather than as a conflicting signature for one it already trusts. That's what I did for the GBoard mod, and it doesn't work here.

This app checks its own package name in a lot of places, and those checks select the OnePlus behavior. i7/y->T() is just getPackageName().equalsIgnoreCase("com.oneplus.deskclock"), and SPContentProvider calls it to pick between two authority constants. Rename the package and every one of those branches silently takes the Oppo path instead.

What blocks a second install

Two things in the manifest fail the install outright, either one on its own:

  • An android:authorities value another installed app already registers gives INSTALL_FAILED_CONFLICTING_PROVIDER.
  • A <permission android:name> another app already declares gives INSTALL_FAILED_DUPLICATE_PERMISSION.

The <original-package android:name="com.oplus.alarmclock"/> line is a different kind of problem. It's the AOSP rename-inheritance tag, so Android reads the install as an upgrade of that package rather than as a new app. Delete the line.

The two apps don't overlap completely, so I'd check which authorities actually conflict instead of guessing. dumpsys package providers prints them in bracket form:

adb shell dumpsys package providers | grep -A1 "^  \[com.oplus.alarmclock.alarmclock\]:"

11 of the 15 authorities in the OnePlus manifest were held by com.coloros.alarmclock. The other four were free.

What changed

I changed the manifest, plus 16 smali files that spell some of the same names out again. Appending .op to every authority and permission not already under com.oneplus.deskclock clears both install conflicts.

Manifest

Authorities and permissions renamed

9 authorities and 7 permissions pick up the suffix. Names already sitting under the app's own package (com.oneplus.deskclock.epona, .tingle, .androidx-startup, .FileShareProvider) collide with nothing and stay as they are.

Nine provider blocks deleted

Deleted rather than renamed, because they serve card frameworks the port has no use for: four Seedling cards, the quick card, the settings search indexer, two AI support providers, and data backup.

One required feature relaxed

oplus.software.support_gp.brand_oneplus ships as required="true" and the Find X9 Pro doesn't declare that feature, so it becomes required="false". Check the device's side of it with adb shell pm list features.

The queries block left alone

Its com.oplus.statistics.provider entry declares an intent to read another app's provider, not one this app registers. Nothing about it conflicts.

The same authorities, again in smali

The manifest is only half of it. An authority the code builds a content:// URI from has to match as well, or the app can't find its own provider.

AuthorityOccurrencesForm
com.coloros.alarmclock.alarmclock3110 bare, 21 inside content:// URIs
com.oplus.alarmclock.alarmclock4bare and URI
com.oplus.alarmclock.sphelper2bare
com.oplus.alarmclock.dial_clock_cities1URI
com.oplus.alarmclock.provider.communicate1bare

Two permission strings are live in the code too, and need the same treatment: com.oplus.alarmclock.permission.DATA_BACKUP_SAFE, and the com.coloros spelling of ACCESS_CLOCK_RECEIVER_PLATFORM.

Four of the renamed authorities don't appear in the smali at all (com.oplus.alarm.provider.widget.wplus, com.coloros.alarmclock.provider.dialclock, com.oplus.alarmclock.provider.dialworldclock, com.oplus.alarmclock.provider.timercard), and the framework resolves those from the manifest, so renaming them there is enough.

A blind find-and-replace breaks the app

com.oplus.alarmclock.alarmclock is also the prefix of roughly 25 broadcast action names (.enter_apk, .cancel_snooze, .clear_notification) and of a number of class-name strings. Suffixing those renames actions that the rest of the system still sends under the old name.

Only append the suffix where the next character is " or /. That catches bare constants and URI authorities, and skips everything dotted:

re.sub(re.escape(auth) + r'(?=["/])', auth + ".op", text)

Keep .bak copies outside the decoded tree. grep -r reads them too, and reports the unpatched originals as though the patch hadn't worked.

Why the weather widgets never fill

Eight of the nine appwidget receivers are com.coloros.widget.smallweather.* weather widgets. The ninth, DigitalAppWidgetProvider, is clock-only and works completely. The eight aren't broken either. They lay out and draw, and everything worked out on the device is right: time, day, date, layout, fonts, the slot the weather icon sits in. The temperature is missing, and it's the one value that has to come from another app.

That app is com.coloros.weather.service, and it only hands weather data to callers on a hardcoded list of package names paired with signing certificate SHA-1 fingerprints. The list is built in com/oplus/weather/service/utils/d.smali and enforced from WeatherProvider.smali. OPWeatherProvider and OPlusWeatherProvider both extend WeatherProvider, so all three data authorities are gated the same way:

  • com.coloros.weather.service.provider.data
  • com.oplus.weather.service.provider.data
  • com.oplusos.weather.service.provider.data

All three are exported="true" and carry no manifest permission, so the gate is invisible until you read the code.

The two doors

if (!privacyAccepted) return false
if (d.c(context, callerPackage)) return true             // certificate whitelist
if (checkCallingOrSelfPermission(OPPO_COMPONENT_SAFE) == GRANTED) return true
return false

The whitelist wants one exact fingerprint per package:

PackageRequired certificate SHA-1
com.oneplus.deskclockB7:91:45:D7:9F:8F:14:C2:6C:68:EC:BB:27:8D:56:AE:43:65:B1:61

A debug-signed rebuild presents something else. The stock ~/.android/debug.keystore gives DF:E2:EE:2A:7D:8F:11:5C:AE:C9:8D:25:70:6C:3E:31:F6:34:7B:77, and gets refused.

The fallback permission doesn't help. oppo.permission.OPPO_COMPONENT_SAFE has a protectionLevel of signature against the oplus platform package, so it can't be granted to a third-party app at all, and pm grant says so in as many words:

SecurityException: Permission oppo.permission.OPPO_COMPONENT_SAFE requested by
package com.oneplus.deskclock is not a changeable permission type

Shizuku is no use either. That refusal came from an adb shell, which is exactly the privilege level Shizuku hands out.

One gate, two callers

Checked in ordercom.coloros.alarmclockstock, platform-signedcom.oneplus.deskclockported, re-signed
Privacy terms acceptedA precondition, settled by the device rather than the caller.passpass
Certificate whitelistDoor one. A package name paired with one exact signing certificate.passfailOn the list by name, wrong fingerprint
Signature permissionDoor two. Signature-level against the oplus platform package, so a third-party app cannot hold it.passfailNot a grantable permission type
Widget reads13°--°
Passing either door is enough. A refused caller receives an empty cursor rather than a permission error, so the failure looks like missing data instead of a rejection.

Both outcomes get logged under WeatherS_ApkSignedCheck. The decision is observable rather than inferred. With the stock clock's weather widget and a ported one on the same home screen, the service judges the pair in the same breath:

checkPackageSignature: signature mismatch, packageName=com.oneplus.deskclock, actualSignature=DF:E2:EE:2A:7D:8F:11:5C:AE:C9:8D:25:70:6C:3E:31:F6:34:7B:77
checkCertificateWhiteList: has safe componentcom.coloros.alarmclock

The stock clock passes both doors at once by being platform-signed. The whitelist does carry an entry for com.oneplus.deskclock, so the port is a caller the service expects. A rebuild keeps the name and loses the fingerprint. Side by side on one home screen, the stock widget reads 13° and the ported one reads --°.

The check is new

d.c() consults SystemProp.isAboveOS14(), which compares the OS version against 30. Below that it goes on the package name alone and never looks at the certificate. At or above it, the name only gets you as far as the signature comparison. ColorOS 16 reports ro.build.version.oplusrom V16.1.0, so it's over the line.

The same port onto ColorOS 14 or earlier would have had working weather, because a re-signed APK keeping the name com.oneplus.deskclock would have passed. This is something I think OPPO tightened at some point, rather than a rule that was always there.

What I tried instead

The gate covers more than a temperature. attent_city and resident_city sit in the same provider as the reading, so location history is behind the same door, and the readings come from a paid upstream feed.

Borrowing another app's access isn't possible in principle. A binder call carries the caller's own UID, the service resolves that to a package and a signature, and Android gives you no way to call under another app's identity. That leaves a whitelisted app willing to re-export what it reads, and on a Find X9 Pro there isn't one. I queried everything else I could think of:

VectorResult
All 28 weather provider authoritiesNone readable (3 gated, 25 erroring)
settings global, system, secureNo cached reading, only the key_com_oplus_weather_service flag
WEATHER_INFO_CHANGED broadcastA re-query trigger with no payload, since the widget reads the provider rather than the intent extras
Weather app notificationsOccasional TravelReminder alerts, no standing temperature
A third-party weather app to read insteadNone installed

The shell hits the same wall. content query against any of the three authorities returns No result found. while the weather app itself shows a current reading, because shell isn't on the list either. An empty result there is the whitelist refusing, not an empty database.

The push direction is gated as well. SystemProp.isOnePlusExp() compares Build.BRAND against ONEPLUS, and the weather service uses the answer to pick which clock package to notify. A Find X9 Pro reports a different brand, so weather-updated broadcasts go to com.coloros.alarmclock and never reach a ported OnePlus clock.

I think the only thing left is dropping the OPPO service and fetching from a public API instead. The clock already holds INTERNET and Open-Meteo needs no key, but the work lands in obfuscated smali in the widget's data path.

How it's built and removed

The usual apktool round trip, the same as the GBoard mod: decompile the stock APK, edit, then apktool b, zipalign and apksigner. It's worth adding aapt2 afterwards to read the compiled manifest back and check the renames actually survived the rebuild:

aapt2 dump xmltree --file AndroidManifest.xml Clock-op.apk | grep -oE 'authorities.*="[^"]*"'

Both apps carry the label Clock once it's installed, so the launcher and the widget picker each show two identical entries.

Removing it is a plain uninstall, since I never touched the stock clock:

adb uninstall com.oneplus.deskclock

Which is what happened to it. The technique works and the app runs, but I just didn't think it was worth keeping over the stock clock once the weather widgets were never going to fill.