summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2019-07-22 19:43:54 +0100
committerEmīls Piņķis <emils@mullvad.net>2019-07-25 18:05:50 +0100
commit6fc6930756bde3be42c38526f514d94efac55e72 (patch)
treec9b12458a268836a04f364bf25b0e1346f9e635f
parent270c7f7b9e74663aa89c037dccf79dcefbcb70c2 (diff)
downloadmullvadvpn-6fc6930756bde3be42c38526f514d94efac55e72.tar.xz
mullvadvpn-6fc6930756bde3be42c38526f514d94efac55e72.zip
Disable factory-reset RPC on Android
-rw-r--r--mullvad-daemon/src/account_history.rs1
-rw-r--r--mullvad-daemon/src/lib.rs2
-rw-r--r--mullvad-daemon/src/management_interface.rs20
3 files changed, 17 insertions, 6 deletions
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index faecc5b5e7..8455c060d2 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -148,6 +148,7 @@ impl AccountHistory {
}
/// Remove account history
+ #[cfg(not(target_os = "android"))]
pub fn clear(&mut self) -> Result<()> {
self.accounts = VecDeque::new();
self.save_to_disk()
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index 4d0fe67f70..5a1901e941 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -708,6 +708,7 @@ where
VerifyWireguardKey(tx) => self.on_verify_wireguard_key(tx),
GetVersionInfo(tx) => self.on_get_version_info(tx),
GetCurrentVersion(tx) => self.on_get_current_version(tx),
+ #[cfg(not(target_os = "android"))]
FactoryReset(tx) => self.on_factory_reset(tx),
Shutdown => self.trigger_shutdown_event(),
}
@@ -942,6 +943,7 @@ where
Self::oneshot_send(tx, self.version.clone(), "get_current_version response");
}
+ #[cfg(not(target_os = "android"))]
fn on_factory_reset(&mut self, tx: oneshot::Sender<()>) {
let mut failed = false;
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index 04193ca9b5..0940780ea3 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -226,6 +226,7 @@ pub enum ManagementCommand {
GetVersionInfo(OneshotSender<BoxFuture<version::AppVersionInfo, mullvad_rpc::Error>>),
/// Get current version of the app
GetCurrentVersion(OneshotSender<version::AppVersion>),
+ #[cfg(not(target_os = "android"))]
/// Remove settings and clear the cache
FactoryReset(OneshotSender<()>),
/// Makes the daemon exit the main loop and quit.
@@ -686,13 +687,20 @@ impl<T: From<ManagementCommand> + 'static + Send> ManagementInterfaceApi
}
fn factory_reset(&self, _: Self::Metadata) -> BoxFuture<(), Error> {
- log::debug!("factory_reset");
- let (tx, rx) = sync::oneshot::channel();
- let future = self
- .send_command_to_daemon(ManagementCommand::FactoryReset(tx))
- .and_then(|_| rx.map_err(|_| Error::internal_error()));
+ #[cfg(not(target_os = "android"))]
+ {
+ log::debug!("factory_reset");
+ let (tx, rx) = sync::oneshot::channel();
+ let future = self
+ .send_command_to_daemon(ManagementCommand::FactoryReset(tx))
+ .and_then(|_| rx.map_err(|_| Error::internal_error()));
- Box::new(future)
+ Box::new(future)
+ }
+ #[cfg(target_os = "android")]
+ {
+ Box::new(future::ok(()))
+ }
}