mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-06 18:20:10 -05:00
12d1097a24
approximating AOSP coding standards.
39 lines
998 B
Java
39 lines
998 B
Java
package com.fsck.k9.service;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.net.Uri;
|
|
import android.util.Log;
|
|
|
|
import com.fsck.k9.K9;
|
|
import com.fsck.k9.mail.store.StorageManager;
|
|
|
|
/**
|
|
* That BroadcastReceiver is only interested in MOUNT events.
|
|
*/
|
|
public class StorageReceiver extends BroadcastReceiver {
|
|
|
|
@Override
|
|
public void onReceive(final Context context, final Intent intent) {
|
|
final String action = intent.getAction();
|
|
final Uri uri = intent.getData();
|
|
|
|
if (uri == null || uri.getPath() == null) {
|
|
return;
|
|
}
|
|
|
|
if (K9.DEBUG) {
|
|
Log.v(K9.LOG_TAG, "StorageReceiver: " + intent.toString());
|
|
}
|
|
|
|
final String path = uri.getPath();
|
|
|
|
if (Intent.ACTION_MEDIA_MOUNTED.equals(action)) {
|
|
StorageManager.getInstance(K9.app).onMount(path,
|
|
intent.getBooleanExtra("read-only", true));
|
|
}
|
|
}
|
|
|
|
}
|