mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 790393 - Add MozPower.factoryReset() for factory reset. r=cjones, r=vingtetun, sr=sicking
This commit is contained in:
parent
41af1327ed
commit
1942917947
@ -41,37 +41,3 @@ interface nsIB2GKeyboard : nsISupports
|
||||
|
||||
attribute nsIDOMEventListener onfocuschange;
|
||||
};
|
||||
|
||||
[scriptable, uuid(acb93ff8-aa6d-4bc8-bedd-2a6a3b802a74)]
|
||||
interface nsIRecoveryService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Possible values of fotaStatus.result. These should stay in sync with
|
||||
* librecovery/librecovery.h
|
||||
*/
|
||||
const long FOTA_UPDATE_UNKNOWN = 0;
|
||||
const long FOTA_UPDATE_FAIL = 1;
|
||||
const long FOTA_UPDATE_SUCCESS = 2;
|
||||
|
||||
/**
|
||||
* Uses recovery to wipe the data and cache partitions. If this call is
|
||||
* successful, the device should reboot before the function call ever returns.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE when rebooting into recovery fails for some reason.
|
||||
*/
|
||||
void factoryReset();
|
||||
|
||||
/**
|
||||
* Use recovery to install an OTA update.zip. If this call is
|
||||
* successful, the device should reboot before the function call ever returns.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE when rebooting into recovery fails for some reason.
|
||||
*/
|
||||
void installFotaUpdate(in string updatePath);
|
||||
|
||||
/**
|
||||
* @return The status of the last FOTA update. One of FOTA_UPDATE_UNKNOWN,
|
||||
* FOTA_UPDATE_FAIL, FOTA_UPDATE_SUCCESS.
|
||||
*/
|
||||
long getFotaUpdateStatus();
|
||||
};
|
||||
|
@ -222,6 +222,7 @@
|
||||
@BINPATH@/components/find.xpt
|
||||
@BINPATH@/components/fuel.xpt
|
||||
@BINPATH@/components/gfx.xpt
|
||||
@BINPATH@/components/hal.xpt
|
||||
@BINPATH@/components/html5.xpt
|
||||
@BINPATH@/components/htmlparser.xpt
|
||||
@BINPATH@/components/imglib2.xpt
|
||||
|
@ -70,6 +70,13 @@ PowerManager::Reboot()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PowerManager::FactoryReset()
|
||||
{
|
||||
hal::FactoryReset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PowerManager::PowerOff()
|
||||
{
|
||||
|
@ -10,11 +10,12 @@ interface nsIDOMMozWakeLockListener;
|
||||
/**
|
||||
* This interface implements navigator.mozPower
|
||||
*/
|
||||
[scriptable, uuid(256a3287-f528-45b5-9ba8-2b3650c056e6)]
|
||||
[scriptable, uuid(7b181fef-2757-4198-89a0-8c426b8439ea)]
|
||||
interface nsIDOMMozPowerManager : nsISupports
|
||||
{
|
||||
void powerOff();
|
||||
void reboot();
|
||||
void factoryReset();
|
||||
|
||||
/**
|
||||
* The listeners are notified when a resource changes its lock state to:
|
||||
|
@ -1000,5 +1000,11 @@ GetFMBandSettings(FMRadioCountry aCountry) {
|
||||
return settings;
|
||||
}
|
||||
|
||||
void FactoryReset()
|
||||
{
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(FactoryReset());
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
} // namespace mozilla
|
||||
|
@ -517,6 +517,11 @@ hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
|
||||
*/
|
||||
void StartForceQuitWatchdog(hal::ShutdownMode aMode, int32_t aTimeoutSecs);
|
||||
|
||||
/**
|
||||
* Perform Factory Reset to wipe out all user data.
|
||||
*/
|
||||
void FactoryReset();
|
||||
|
||||
} // namespace MOZ_HAL_NAMESPACE
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -21,6 +21,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = hal
|
||||
LIBRARY_NAME = hal_s
|
||||
XPIDL_MODULE = hal
|
||||
FORCE_STATIC_LIB = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
@ -36,6 +37,10 @@ EXPORTS_mozilla = \
|
||||
HalWakeLock.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIRecoveryService.idl \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
Hal.cpp \
|
||||
SandboxHal.cpp \
|
||||
@ -127,6 +132,7 @@ CPPSRCS += \
|
||||
FallbackScreenPower.cpp \
|
||||
FallbackProcessPriority.cpp \
|
||||
FallbackFMRadio.cpp \
|
||||
FallbackFactoryReset.cpp \
|
||||
$(NULL)
|
||||
endif #}
|
||||
|
||||
|
18
hal/fallback/FallbackFactoryReset.cpp
Normal file
18
hal/fallback/FallbackFactoryReset.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=8 et :
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "Hal.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
||||
void
|
||||
FactoryReset()
|
||||
{}
|
||||
|
||||
} // namespace hal_impl
|
||||
} // namespace mozilla
|
@ -46,6 +46,7 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIRecoveryService.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsScreenManagerGonk.h"
|
||||
#include "nsThreadUtils.h"
|
||||
@ -952,5 +953,18 @@ SetProcessPriority(int aPid, ProcessPriority aPriority)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FactoryReset()
|
||||
{
|
||||
nsCOMPtr<nsIRecoveryService> recoveryService =
|
||||
do_GetService("@mozilla.org/recovery-service;1");
|
||||
if (!recoveryService) {
|
||||
NS_WARNING("Could not get recovery service!");
|
||||
return;
|
||||
}
|
||||
|
||||
recoveryService->FactoryReset();
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
} // mozilla
|
||||
|
39
hal/gonk/nsIRecoveryService.idl
Normal file
39
hal/gonk/nsIRecoveryService.idl
Normal file
@ -0,0 +1,39 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(acb93ff8-aa6d-4bc8-bedd-2a6a3b802a74)]
|
||||
interface nsIRecoveryService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Possible values of fotaStatus.result. These should stay in sync with
|
||||
* librecovery/librecovery.h
|
||||
*/
|
||||
const long FOTA_UPDATE_UNKNOWN = 0;
|
||||
const long FOTA_UPDATE_FAIL = 1;
|
||||
const long FOTA_UPDATE_SUCCESS = 2;
|
||||
|
||||
/**
|
||||
* Uses recovery to wipe the data and cache partitions. If this call is
|
||||
* successful, the device should reboot before the function call ever returns.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE when rebooting into recovery fails for some reason.
|
||||
*/
|
||||
void factoryReset();
|
||||
|
||||
/**
|
||||
* Use recovery to install an OTA update.zip. If this call is
|
||||
* successful, the device should reboot before the function call ever returns.
|
||||
*
|
||||
* @throws NS_ERROR_FAILURE when rebooting into recovery fails for some reason.
|
||||
*/
|
||||
void installFotaUpdate(in string updatePath);
|
||||
|
||||
/**
|
||||
* @return The status of the last FOTA update. One of FOTA_UPDATE_UNKNOWN,
|
||||
* FOTA_UPDATE_FAIL, FOTA_UPDATE_SUCCESS.
|
||||
*/
|
||||
long getFotaUpdateStatus();
|
||||
};
|
@ -178,6 +178,8 @@ parent:
|
||||
returns (uint32_t strength);
|
||||
CancelFMRadioSeek();
|
||||
|
||||
FactoryReset();
|
||||
|
||||
child:
|
||||
NotifySensorChange(SensorData aSensorData);
|
||||
|
||||
|
@ -381,6 +381,12 @@ CancelFMRadioSeek()
|
||||
Hal()->SendCancelFMRadioSeek();
|
||||
}
|
||||
|
||||
void
|
||||
FactoryReset()
|
||||
{
|
||||
Hal()->SendFactoryReset();
|
||||
}
|
||||
|
||||
class HalParent : public PHalParent
|
||||
, public BatteryObserver
|
||||
, public NetworkObserver
|
||||
@ -842,6 +848,16 @@ public:
|
||||
hal::CancelFMRadioSeek();
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvFactoryReset()
|
||||
{
|
||||
if (!AssertAppProcessPermission(this, "power")) {
|
||||
return false;
|
||||
}
|
||||
hal::FactoryReset();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class HalChild : public PHalChild {
|
||||
|
Loading…
Reference in New Issue
Block a user