10a2b7ed25
Merge pull request !601 from LVB8189/master |
||
---|---|---|
figures | ||
frameworks | ||
interfaces/inner_api/include | ||
services | ||
test | ||
utils | ||
BUILD.gn | ||
bundle.json | ||
CODEOWNERS | ||
hisysevent.yaml | ||
LICENSE | ||
OAT.xml | ||
README_ZH.md | ||
README.md | ||
wallpaper.gni |
wallpaper service
Introduction
1、Provide wallpaper service capability for the system, and support wallpaper display, setting, switching wallpaper and other functions;
2、Provide the framework and interface for developers to develop wallpaper, and develop wallpaper applications;
subsystem architecture diagram
Warehouse path
/base/theme/wallpaper_mgr
Introduction to framework code
/base/theme/wallpaper_mgr ├── figures # architecture diagram ├── frameworks │ ├── js/napi # the js interface resolves to the napi interface │ ├── kits/extension # extension │ └── native # interface provided for app ├── services # implementation of wallpaper manager service │ ├── profile # module contains the config files of system services │ └── etc # module contains the config files of processes ├── test # unit test of interface └── utils # module contains log printing and constants for ordered commonEvent
Interface Introduction
Table 1 Main method of wallpaper service
JS APIs instructions
//get pixelmap callback with callback
wallpaper.getPixelMap(WALLPAPER_SYSTEM, function (err, data) {
console.info('wallpaperXTS ===> testGetPixelMapCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testGetPixelMapCallbackSystem data : ' + JSON.stringify(data));
if(err){
expect(null).assertFail();
}
if((data != undefined) && (data != null) && (data != '')){
expect(true).assertTrue();
}
})
//get pixelmap callback with Promise
wallpaper.getPixelMap(WALLPAPER_SYSTEM).then((data) => {
console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + data);
console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + JSON.stringify(data));
if((data != undefined) && (data != null) && (data != '')){
expect(true).assertTrue();
}
}).catch((err) => {
console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem err : ' + err);
console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem err : ' + JSON.stringify(err));
if(err){
expect(null).assertFail();
}
});
//set pixelmap callback with callback
wallpaper.setWallpaper(pixelmap, WALLPAPER_SYSTEM, function (err, data) {
console.info('wallpaperXTS ===> testSetWallpaperPixelMapCallbackSystem err : ' + JSON.stringify(err));
console.info('wallpaperXTS ===> testSetWallpaperPixelMapCallbackSystem data : ' + JSON.stringify(data));
if(err){
expect(null).assertFail();
}
if((data != undefined) && (data != null) && (data != '')){
expect(true).assertTrue();
}
});
//set pixelmap callback with Promise
wallpaper.setWallpaper(pixelmap, WALLPAPER_SYSTEM).then((data) => {
console.info('wallpaperXTS ===> testSetWallpaperPixelMapPromiseSystem data : ' + JSON.stringify(data));
if((data != undefined) && (data != null) && (data != '')){
expect(true).assertTrue();
}
}).catch((err) => {
console.info('wallpaperXTS ===> testSetWallpaperPixelMapPromiseSystem err : ' + JSON.stringify(err));
if(err){
expect(null).assertFail();
}
});
Participation contribution
- Fork warehouse
- Submission code
- Create a new pull request
- Commit is complete