client: pawlet-client-sdk, public-SDK-only, installable:false, built for external AAR/jar publishing. device: pawlet-device, platform_apis:true, product-partition device API. system: pawlet-system + pawlet-manager-service, platform_apis:true, shared AIDL now a filegroup so client can compile its own copy without a ".." path reference. Removed core/java/pawletos/device/system/PawletManager.java -- a ServiceManager-based accessor that was never actually wired up (nothing ever called ServiceManager.addService), so it always returned null. PawletClient already covers this without a privileged-only path.
95 lines
2.8 KiB
Markdown
95 lines
2.8 KiB
Markdown
# PawletOS Framework API
|
|
|
|
This repository contains the **PawletOS framework APIs**, providing both system-level and device-level functionality for apps running on PawletOS builds.
|
|
|
|
## Modules
|
|
|
|
### 0. Client SDK (`pawletos.device.client`) — for any app, in or outside PawletOS
|
|
|
|
The one other apps should actually import. `pawlet-device`/`pawlet-system`
|
|
below are built `platform_apis: true` and use hidden APIs
|
|
(`SystemProperties`, `ServiceManager`) — they only link inside this AOSP
|
|
tree, and a normal Gradle project can't compile against them at all. The
|
|
client SDK is the public-SDK-only equivalent: it reaches the same data over
|
|
`bindService()` to an exported component hosted by the platform app
|
|
(`me.pawlet.android`/`PawletBinderService`), not `ServiceManager`, so it
|
|
works from any app signed with any key, built with any toolchain.
|
|
|
|
Published as a Maven artifact (`publish/` — separate Gradle module, not part
|
|
of the Soong build, see its own comments) to PawletOS's Gitea package
|
|
registry:
|
|
|
|
```kotlin
|
|
repositories {
|
|
maven { url = uri("https://git.oxmc.me/api/packages/PawletOS/maven") }
|
|
}
|
|
dependencies {
|
|
implementation("me.pawlet:pawlet-client-sdk:0.1.0")
|
|
}
|
|
```
|
|
|
|
```java
|
|
import pawletos.device.client.PawletClient;
|
|
|
|
PawletClient client = PawletClient.create(context);
|
|
client.connect(new PawletClient.ConnectionCallback() {
|
|
public void onConnected(PawletClient c) {
|
|
try {
|
|
String version = c.getPawletVersion();
|
|
} catch (RemoteException e) { /* ... */ }
|
|
}
|
|
public void onDisconnected() {}
|
|
});
|
|
```
|
|
|
|
Read-only by design: `setFeatureEnabled` stays a privileged, in-tree-only
|
|
call (`pawletos.permission.MANAGE_PAWLET_FEATURES`, signature-level,
|
|
enforced in `PawletManagerService`) — not exposed here.
|
|
|
|
---
|
|
|
|
### 1. System API (`pawletos.device.system`)
|
|
|
|
Intended for **system apps**.
|
|
|
|
`PawletSystem` provides static, no-service-needed checks:
|
|
|
|
* Emulator detection
|
|
* Root status checks
|
|
* PawletOS detection
|
|
* Pawlet SDK version
|
|
* Locale information
|
|
|
|
Example usage in a system app:
|
|
|
|
```java
|
|
import pawletos.device.system.PawletSystem;
|
|
|
|
boolean isEmulator = PawletSystem.isEmulator();
|
|
double sdkVersion = PawletSystem.getPawletSDKVersion();
|
|
```
|
|
|
|
For anything needing live service data (build/device info, provisioning
|
|
state, feature flags), system apps use the same `PawletClient` (Client SDK,
|
|
below) as everyone else — it binds to PawletPlatform's exported service.
|
|
|
|
---
|
|
|
|
### 2. Device API (`pawletos.device`)
|
|
|
|
Intended for **user apps**.
|
|
|
|
Provides access to device-specific information:
|
|
|
|
* Brand and codename
|
|
* Custom build properties (`ro.pawlet.build.*`)
|
|
* Manufacture date, series, warranty info
|
|
|
|
Example usage in a user app:
|
|
|
|
```java
|
|
import pawletos.device.PawletDevice;
|
|
|
|
String model = PawletDevice.getDeviceModel();
|
|
String series = PawletDevice.getSeries();
|
|
``` |