Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93f84e5a authored by Willie Koomson's avatar Willie Koomson
Browse files

Save generated previews in AppWidgetService

This change updates AppWidgetServiceImpl to persist generated
previews in /data/system_ce/<user>/appwidget/previews. Each file
contains the previews for a single provider, written as a
GeneratedPreviewsProto message.

Previews are cleared when a provider app is updated, deleted
(PACKAGE_REMOVED) or its data is cleared (PACKAGE_DATA_CLEARED).

Also updates the bug for the feature flag to the correct number.

Test: Manual, set previews and reboot, then clear data and remove
 package.
Test: AppWidgetTest#testGeneratedPreviewPersistence
Bug: 364420494
Flag: android.appwidget.flags.remote_views_proto
Change-Id: I92e115602202efd1c2964364bc3ef32fda0ae472
parent 705c4de6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ flag {
  name: "remote_views_proto"
  namespace: "app_widgets"
  description: "Enable support for persisting RemoteViews previews to Protobuf"
  bug: "306546610"
  bug: "364420494"
}

flag {
+13 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ package android.service.appwidget;
option java_multiple_files = true;
option java_outer_classname = "AppWidgetServiceProto";

import "frameworks/base/core/proto/android/widget/remoteviews.proto";

// represents the object holding the dump info of the app widget service
message AppWidgetServiceDumpProto {
    repeated WidgetProto widgets = 1; // the array of bound widgets
@@ -38,3 +40,14 @@ message WidgetProto {
    optional int32 maxHeight = 9;
    optional bool restoreCompleted = 10;
}

// represents a set of widget previews for a particular provider
message GeneratedPreviewsProto {
    repeated Preview previews = 1;

    // represents a particular RemoteViews preview, which may be set for multiple categories
    message Preview {
        repeated int32 widget_categories = 1;
        optional android.widget.RemoteViewsProto views = 2;
    }
}
 No newline at end of file
+425 −15

File changed.

Preview size limit exceeded, changes collapsed.