summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2013-11-15 02:34:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-11-15 02:34:38 +0000
commit22010817b90f97756a76777fcd1dbe7e3b63e808 (patch)
tree2eead3fac5e069223774cd730665eb77fd3edd24 /core/java
parent1907c0d280d97776708810c9d24931aa6f818790 (diff)
parentcefba58d14f9669b57c16b4ea493779d882c43bd (diff)
downloadframeworks_base-22010817b90f97756a76777fcd1dbe7e3b63e808.zip
frameworks_base-22010817b90f97756a76777fcd1dbe7e3b63e808.tar.gz
frameworks_base-22010817b90f97756a76777fcd1dbe7e3b63e808.tar.bz2
Merge "Handle backup transport registration dynamically" into klp-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/backup/IBackupTransport.aidl6
-rw-r--r--core/java/com/android/internal/backup/LocalTransport.java5
-rw-r--r--core/java/com/android/internal/backup/LocalTransportService.java37
3 files changed, 48 insertions, 0 deletions
diff --git a/core/java/com/android/internal/backup/IBackupTransport.aidl b/core/java/com/android/internal/backup/IBackupTransport.aidl
index 5bfa1b2..1e37fd9 100644
--- a/core/java/com/android/internal/backup/IBackupTransport.aidl
+++ b/core/java/com/android/internal/backup/IBackupTransport.aidl
@@ -23,6 +23,12 @@ import android.os.ParcelFileDescriptor;
/** {@hide} */
interface IBackupTransport {
+ /**
+ * Ask the transport for the name under which it should be registered. This will
+ * typically be its host service's component name, but need not be.
+ */
+ String name();
+
/**
* Ask the transport for an Intent that can be used to launch any internal
* configuration Activity that it wishes to present. For example, the transport
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index eb2d1fe..494bc78 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -19,6 +19,7 @@ package com.android.internal.backup;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.app.backup.RestoreSet;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
@@ -71,6 +72,10 @@ public class LocalTransport extends IBackupTransport.Stub {
}
}
+ public String name() {
+ return new ComponentName(mContext, this.getClass()).flattenToShortString();
+ }
+
public Intent configurationIntent() {
// The local transport is not user-configurable
return null;
diff --git a/core/java/com/android/internal/backup/LocalTransportService.java b/core/java/com/android/internal/backup/LocalTransportService.java
new file mode 100644
index 0000000..d05699a
--- /dev/null
+++ b/core/java/com/android/internal/backup/LocalTransportService.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.backup;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+public class LocalTransportService extends Service {
+ private static LocalTransport sTransport = null;
+
+ @Override
+ public void onCreate() {
+ if (sTransport == null) {
+ sTransport = new LocalTransport(this);
+ }
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return sTransport;
+ }
+}