Search in sources :

Example 1 with IWallpaperService

use of android.app.IWallpaperService in project platform_packages_apps_launcher by android.

the class Launcher method setWallpaperDimension.

private void setWallpaperDimension() {
    IBinder binder = ServiceManager.getService(WALLPAPER_SERVICE);
    IWallpaperService wallpaperService = IWallpaperService.Stub.asInterface(binder);
    Display display = getWindowManager().getDefaultDisplay();
    boolean isPortrait = display.getWidth() < display.getHeight();
    final int width = isPortrait ? display.getWidth() : display.getHeight();
    final int height = isPortrait ? display.getHeight() : display.getWidth();
    try {
        wallpaperService.setDimensionHints(width * WALLPAPER_SCREENS_SPAN, height);
    } catch (RemoteException e) {
    // System is dead!
    }
}
Also used : IBinder(android.os.IBinder) RemoteException(android.os.RemoteException) IWallpaperService(android.app.IWallpaperService) Display(android.view.Display)

Aggregations

IWallpaperService (android.app.IWallpaperService)1 IBinder (android.os.IBinder)1 RemoteException (android.os.RemoteException)1 Display (android.view.Display)1