Merge "Move transport out of system server."
This commit is contained in:
committed by
Android (Google) Code Review
commit
bf8b6c02f3
@ -4463,14 +4463,6 @@
|
||||
android:permission="android.permission.LOCATION_HARDWARE"
|
||||
android:exported="false" />
|
||||
|
||||
<service android:name="com.android.internal.backup.LocalTransportService"
|
||||
android:permission="android.permission.CONFIRM_FULL_BACKUP"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.backup.TRANSPORT_HOST" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service android:name="com.android.server.MountServiceIdler"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" >
|
||||
|
@ -73,7 +73,7 @@ public class SettingsValidatorsTest {
|
||||
@Test
|
||||
public void testComponentNameValidator() {
|
||||
assertTrue(SettingsValidators.COMPONENT_NAME_VALIDATOR.validate(
|
||||
"android/com.android.internal.backup.LocalTransport"));
|
||||
"com.android.localtransport/.LocalTransport"));
|
||||
assertFalse(SettingsValidators.COMPONENT_NAME_VALIDATOR.validate("rectangle"));
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class SettingsValidatorsTest {
|
||||
@Test
|
||||
public void testNullableComponentNameValidator_onValidComponentName_returnsTrue() {
|
||||
assertTrue(SettingsValidators.NULLABLE_COMPONENT_NAME_VALIDATOR.validate(
|
||||
"android/com.android.internal.backup.LocalTransport"));
|
||||
"com.android.localtransport/.LocalTransport"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -185,7 +185,7 @@ public class SettingsValidatorsTest {
|
||||
@Test
|
||||
public void testComponentNameListValidator() {
|
||||
Validator v = new SettingsValidators.ComponentNameListValidator(",");
|
||||
assertTrue(v.validate("android/com.android.internal.backup.LocalTransport,"
|
||||
assertTrue(v.validate("com.android.localtransport/.LocalTransport,"
|
||||
+ "com.google.android.gms/.backup.migrate.service.D2dTransport"));
|
||||
assertFalse(v.validate("com.google.5android,android"));
|
||||
}
|
||||
@ -200,7 +200,7 @@ public class SettingsValidatorsTest {
|
||||
@Test
|
||||
public void testPackageNameListValidator() {
|
||||
Validator v = new SettingsValidators.PackageNameListValidator(",");
|
||||
assertTrue(v.validate("com.android.internal.backup.LocalTransport,com.google.android.gms"));
|
||||
assertTrue(v.validate("com.android.localtransport.LocalTransport,com.google.android.gms"));
|
||||
assertFalse(v.validate("5com.android.internal.backup.LocalTransport,android"));
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
<!-- Whitelist of what components are permitted as backup data transports. The
|
||||
'service' attribute here is a flattened ComponentName string. -->
|
||||
<backup-transport-whitelisted-service
|
||||
service="android/com.android.internal.backup.LocalTransportService" />
|
||||
service="com.android.localtransport/.LocalTransportService" />
|
||||
|
||||
<!-- Whitelist of bundled applications which all handle URLs to their websites by default -->
|
||||
<app-link package="com.android.carrierdefaultapp" />
|
||||
|
35
packages/LocalTransport/Android.mk
Normal file
35
packages/LocalTransport/Android.mk
Normal file
@ -0,0 +1,35 @@
|
||||
#
|
||||
# Copyright (C) 2018 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.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
LOCAL_PACKAGE_NAME := LocalTransport
|
||||
LOCAL_PRIVATE_PLATFORM_APIS := true
|
||||
LOCAL_CERTIFICATE := platform
|
||||
LOCAL_PRIVILEGED_MODULE := true
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
########################
|
||||
include $(call all-makefiles-under,$(LOCAL_PATH))
|
||||
|
36
packages/LocalTransport/AndroidManifest.xml
Normal file
36
packages/LocalTransport/AndroidManifest.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
* Copyright (c) 2018 Google Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.localtransport"
|
||||
android:sharedUserId="android.uid.system" >
|
||||
|
||||
|
||||
<application android:allowBackup="false" >
|
||||
<!-- This service does not need to be exported because it shares uid with the system server
|
||||
which is the only client. -->
|
||||
<service android:name=".LocalTransportService"
|
||||
android:permission="android.permission.CONFIRM_FULL_BACKUP"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.backup.TRANSPORT_HOST" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
</manifest>
|
5
packages/LocalTransport/proguard.flags
Normal file
5
packages/LocalTransport/proguard.flags
Normal file
@ -0,0 +1,5 @@
|
||||
-keep class com.android.localTransport.LocalTransport
|
||||
-keep class com.android.localTransport.LocalTransportParameters
|
||||
-keep class com.android.localTransport.LocalTransportService
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.internal.backup;
|
||||
package com.android.localtransport;
|
||||
|
||||
import android.app.backup.BackupAgent;
|
||||
import android.app.backup.BackupDataInput;
|
||||
@ -26,7 +26,6 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Environment;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
@ -56,7 +55,7 @@ public class LocalTransport extends BackupTransport {
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final String TRANSPORT_DIR_NAME
|
||||
= "com.android.internal.backup.LocalTransport";
|
||||
= "com.android.localtransport.LocalTransport";
|
||||
|
||||
private static final String TRANSPORT_DESTINATION_STRING
|
||||
= "Backing up to debug-only private cache";
|
||||
@ -75,10 +74,10 @@ public class LocalTransport extends BackupTransport {
|
||||
private static final long KEY_VALUE_BACKUP_SIZE_QUOTA = 5 * 1024 * 1024;
|
||||
|
||||
private Context mContext;
|
||||
private File mDataDir = new File(Environment.getDownloadCacheDirectory(), "backup");
|
||||
private File mCurrentSetDir = new File(mDataDir, Long.toString(CURRENT_SET_TOKEN));
|
||||
private File mCurrentSetIncrementalDir = new File(mCurrentSetDir, INCREMENTAL_DIR);
|
||||
private File mCurrentSetFullDir = new File(mCurrentSetDir, FULL_DATA_DIR);
|
||||
private File mDataDir;
|
||||
private File mCurrentSetDir;
|
||||
private File mCurrentSetIncrementalDir;
|
||||
private File mCurrentSetFullDir;
|
||||
|
||||
private PackageInfo[] mRestorePackages = null;
|
||||
private int mRestorePackage = -1; // Index into mRestorePackages
|
||||
@ -101,6 +100,11 @@ public class LocalTransport extends BackupTransport {
|
||||
private final LocalTransportParameters mParameters;
|
||||
|
||||
private void makeDataDirs() {
|
||||
mDataDir = mContext.getFilesDir();
|
||||
mCurrentSetDir = new File(mDataDir, Long.toString(CURRENT_SET_TOKEN));
|
||||
mCurrentSetIncrementalDir = new File(mCurrentSetDir, INCREMENTAL_DIR);
|
||||
mCurrentSetFullDir = new File(mCurrentSetDir, FULL_DATA_DIR);
|
||||
|
||||
mCurrentSetDir.mkdirs();
|
||||
mCurrentSetFullDir.mkdir();
|
||||
mCurrentSetIncrementalDir.mkdir();
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License
|
||||
*/
|
||||
|
||||
package com.android.internal.backup;
|
||||
package com.android.localtransport;
|
||||
|
||||
import android.util.KeyValueSettingObserver;
|
||||
import android.content.ContentResolver;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.internal.backup;
|
||||
package com.android.localtransport;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
@ -55,7 +55,7 @@
|
||||
<bool name="def_networks_available_notification_on">true</bool>
|
||||
|
||||
<bool name="def_backup_enabled">false</bool>
|
||||
<string name="def_backup_transport" translatable="false">android/com.android.internal.backup.LocalTransport</string>
|
||||
<string name="def_backup_transport" translatable="false">com.android.localtransport/.LocalTransport</string>
|
||||
|
||||
<!-- Default value for whether or not to pulse the notification LED when there is a
|
||||
pending notification -->
|
||||
|
@ -48,9 +48,9 @@ public class TransportData {
|
||||
|
||||
public static TransportData localTransport() {
|
||||
return new TransportData(
|
||||
"android/com.android.internal.backup.LocalTransport",
|
||||
"android/com.android.internal.backup.LocalTransportService",
|
||||
"com.android.internal.backup.LocalTransport",
|
||||
"com.android.localtransport/.LocalTransport",
|
||||
"com.android.localtransport/.LocalTransportService",
|
||||
"com.android.localtransport.LocalTransport",
|
||||
null,
|
||||
"Backing up to debug-only private cache",
|
||||
null,
|
||||
|
Reference in New Issue
Block a user