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

Commit ef920ddf authored by The Android Automerger's avatar The Android Automerger
Browse files

Merge branch 'froyo' into froyo-release

parents e07ec4b5 2e3761ba
Loading
Loading
Loading
Loading
+67 −13
Original line number Diff line number Diff line
@@ -24,32 +24,51 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * Monitors files (using <a href="http://en.wikipedia.org/wiki/Inotify">inotify</a>)
 * to fire an event after files are accessed or changed by by any process on
 * the device (including this one).  FileObserver is an abstract class;
 * subclasses must implement the event handler {@link #onEvent(int, String)}.
 *
 * <p>Each FileObserver instance monitors a single file or directory.
 * If a directory is monitored, events will be triggered for all files and
 * subdirectories (recursively) inside the monitored directory.</p>
 *
 * <p>An event mask is used to specify which changes or actions to report.
 * Event type constants are used to describe the possible changes in the
 * event mask as well as what actually happened in event callbacks.</p>
 *
 * <p class="caution"><b>Warning</b>: If a FileObserver is garbage collected, it
 * will stop sending events.  To ensure you keep receiving events, you must
 * keep a reference to the FileObserver instance from some other live object.</p>
 */
public abstract class FileObserver {
    /** File was accessed */
    /** Event type: Data was read from a file */
    public static final int ACCESS = 0x00000001;
    /** File was modified */
    /** Event type: Data was written to a file */
    public static final int MODIFY = 0x00000002;
    /** Metadata changed */
    /** Event type: Metadata (permissions, owner, timestamp) was changed explicitly */
    public static final int ATTRIB = 0x00000004;
    /** Writable file was closed */
    /** Event type: Someone had a file or directory open for writing, and closed it */
    public static final int CLOSE_WRITE = 0x00000008;
    /** Unwrittable file closed */
    /** Event type: Someone had a file or directory open read-only, and closed it */
    public static final int CLOSE_NOWRITE = 0x00000010;
    /** File was opened */
    /** Event type: A file or directory was opened */
    public static final int OPEN = 0x00000020;
    /** File was moved from X */
    /** Event type: A file or subdirectory was moved from the monitored directory */
    public static final int MOVED_FROM = 0x00000040;
    /** File was moved to Y */
    /** Event type: A file or subdirectory was moved to the monitored directory */
    public static final int MOVED_TO = 0x00000080;
    /** Subfile was created */
    /** Event type: A new file or subdirectory was created under the monitored directory */
    public static final int CREATE = 0x00000100;
    /** Subfile was deleted */
    /** Event type: A file was deleted from the monitored directory */
    public static final int DELETE = 0x00000200;
    /** Self was deleted */
    /** Event type: The monitored file or directory was deleted; monitoring effectively stops */
    public static final int DELETE_SELF = 0x00000400;
    /** Self was moved */
    /** Event type: The monitored file or directory was moved; monitoring continues */
    public static final int MOVE_SELF = 0x00000800;

    /** Event mask: All valid event types, combined */
    public static final int ALL_EVENTS = ACCESS | MODIFY | ATTRIB | CLOSE_WRITE
            | CLOSE_NOWRITE | OPEN | MOVED_FROM | MOVED_TO | DELETE | CREATE
            | DELETE_SELF | MOVE_SELF;
@@ -128,10 +147,21 @@ public abstract class FileObserver {
    private Integer m_descriptor;
    private int m_mask;

    /**
     * Equivalent to FileObserver(path, FileObserver.ALL_EVENTS).
     */
    public FileObserver(String path) {
        this(path, ALL_EVENTS);
    }

    /**
     * Create a new file observer for a certain file or directory.
     * Monitoring does not start on creation!  You must call
     * {@link #startWatching()} before you will receive events.
     *
     * @param path The file or directory to monitor
     * @param mask The event or events (added together) to watch for
     */
    public FileObserver(String path, int mask) {
        m_path = path;
        m_mask = mask;
@@ -142,12 +172,22 @@ public abstract class FileObserver {
        stopWatching();
    }

    /**
     * Start watching for events.  The monitored file or directory must exist at
     * this time, or else no events will be reported (even if it appears later).
     * If monitoring is already started, this call has no effect.
     */
    public void startWatching() {
        if (m_descriptor < 0) {
            m_descriptor = s_observerThread.startWatching(m_path, m_mask, this);
        }
    }

    /**
     * Stop watching for events.  Some events may be in process, so events
     * may continue to be reported even after this method completes.  If
     * monitoring is already stopped, this call has no effect.
     */
    public void stopWatching() {
        if (m_descriptor >= 0) {
            s_observerThread.stopWatching(m_descriptor);
@@ -155,5 +195,19 @@ public abstract class FileObserver {
        }
    }

    /**
     * The event handler, which must be implemented by subclasses.
     *
     * <p class="note">This method is invoked on a special FileObserver thread.
     * It runs independently of any threads, so take care to use appropriate
     * synchronization!  Consider using {@link Handler#post(Runnable)} to shift
     * event handling work to the main thread to avoid concurrency problems.</p>
     *
     * <p>Event handlers must not throw exceptions.</p>
     *
     * @param event The type of event which happened
     * @param path The path, relative to the main monitored file or directory,
     *     of the file or directory which triggered the event
     */
    public abstract void onEvent(int event, String path);
}
+1 −1
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ onBackup()}.
<p>For an example implementation of {@link android.app.backup.BackupAgent}, see the <a
href="{@docRoot}resources/samples/BackupRestore/src/com/example/android/backuprestore/ExampleAgent.html">{@code
ExampleAgent}</a> class in the <a
href="{@docRoot}}resources/samples/BackupRestore/index.html">Backup and Restore</a> sample
href="{@docRoot}resources/samples/BackupRestore/index.html">Backup and Restore</a> sample
application.</p>
</div>

+8 −9
Original line number Diff line number Diff line
@@ -40,15 +40,14 @@ includes reading or writing the user's private data (such as contacts or
e-mails), reading or writing another application's files, performing
network access, keeping the device awake, etc.<p>

<p>An application's process is a secure sandbox.  It can't disrupt other
applications, except by explicitly declaring the <em>permissions</em> it needs
for additional capabilities not provided by the basic sandbox.  These
permissions it requests can be handled by the operating in various ways,
typically by automatically allowing or disallowing based on certificates or
by prompting the user.  The permissions required by an application are declared
statically in that application, so they can be known up-front at install time
and will not change after that.</p>

<p>An application's process runs in a security sandbox. The sandbox is designed
to prevent applications from disrupting each other, except by explicitly
declaring the <em>permissions</em> they need for additional capabilities not
provided by the basic sandbox. The system handles requests for permissions
in various ways, typically by automatically allowing or disallowing based on
certificates or by prompting the user.  The permissions required by an
application are declared statically in that application, so they can be known
up-front at install time and will not change after that.</p>

<a name="signing"></a>
<h2>Application Signing</h2>
+7 −7
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ ending on the data collection date noted below.</p>
<div class="dashboard-panel">

<img alt="" width="460" height="250"
src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:0.1,35.6,28.1,0.2,0.4,35.6&chl=
src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:0.1,27.6,26.8,0.1,0.3,45.1&chl=
Android%201.1|Android%201.5|Android%201.6|Android%202.0|Android%202.0.1|Android%202.1&chco=c4df9b,
6fad0c" />

@@ -60,12 +60,12 @@ Android%201.1|Android%201.5|Android%201.6|Android%202.0|Android%202.0.1|Android%
  <th>Percent of Devices</th>
</tr>
<tr><td>Android 1.1</td><td>0.1%</td></tr>
<tr><td>Android 1.5</td><td>34.1%</td></tr>
<tr><td>Android 1.6</td><td>28.0%</td></tr>
<tr><td>Android 2.0</td><td>0.2%</td></tr>
<tr><td>Android 2.0.1</td><td>0.4%</td></tr>
<tr><td>Android 2.1</td><td>37.2%</td></tr>
<tr><td>Android 1.5</td><td>27.6%</td></tr>
<tr><td>Android 1.6</td><td>26.8%</td></tr>
<tr><td>Android 2.0</td><td>0.1%</td></tr>
<tr><td>Android 2.0.1</td><td>0.3%</td></tr>
<tr><td>Android 2.1</td><td>45.1%</td></tr>
</table>
<p><em>Data collected during two weeks ending on May 17, 2010</em></p>
<p><em>Data collected during two weeks ending on June 1, 2010</em></p>
</div>
+4 −4
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ ending on the data collection date noted below.</p>
<div class="dashboard-panel">

<img alt="" width="460" height="250"
src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:1.0,63.9,35.1&chl=Small%20/%20ldpi|
src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:1.0,61.6,37.4&chl=Small%20/%20ldpi|
Normal%20/%20mdpi|Normal%20/%20hdpi&chco=c4df9b,6fad0c" />

<table>
@@ -66,8 +66,8 @@ Normal%20/%20mdpi|Normal%20/%20hdpi&chco=c4df9b,6fad0c" />
</tr> 
<tr><th scope="row">Normal</th> 
<td></td> 
<td class='cent hi'>63.7%</td> 
<td class='cent hi'>35.3%</td> 
<td class='cent hi'>61.3%</td> 
<td class='cent hi'>37.7%</td> 
</tr> 
<tr><th scope="row">Large</th> 
<td></td> 
@@ -76,6 +76,6 @@ Normal%20/%20mdpi|Normal%20/%20hdpi&chco=c4df9b,6fad0c" />
</tr> 
</table>

<p><em>Data collected during two weeks ending on May 17, 2010</em></p>
<p><em>Data collected during two weeks ending on June 1, 2010</em></p>
</div>
Loading