1bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk/*
2bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * Copyright (C) 2018 The Android Open Source Project
3bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk *
4bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * except in compliance with the License. You may obtain a copy of the License at
6bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk *
7bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk *      http://www.apache.org/licenses/LICENSE-2.0
8bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk *
9bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * Unless required by applicable law or agreed to in writing, software distributed under the
10bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * KIND, either express or implied. See the License for the specific language governing
12bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * permissions and limitations under the License.
13bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk */
14bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk
15bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monkpackage com.android.server.slice;
16bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk
17bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monkimport org.xmlpull.v1.XmlSerializer;
18bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk
19bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monkimport java.io.IOException;
20bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk
21bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk/**
22bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * A parent object that cares when a Persistable changes and will schedule a serialization
23bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk * in response to the onPersistableDirty callback.
24bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk */
25bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monkpublic interface DirtyTracker {
26bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk    void onPersistableDirty(Persistable obj);
27bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk
28bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk    /**
29bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk     * An object that can be written to XML.
30bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk     */
31bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk    interface Persistable {
32bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk        String getFileName();
33bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk        void writeTo(XmlSerializer out) throws IOException;
34bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk    }
35bf3eedcc6b340bc03c72cdb45305a8f93dd5b382Jason Monk}
36