Vision Mission of Department:: Android Battery Saver System.
Vision Mission of Department:: Android Battery Saver System.
Group Members:-
Name:-Nikita Chandrakant Panchal
Roll No:-112
Name:-Nikita Laxman Avchar
Roll No:-143
Content(Index)
Project
Abstract---------------------------------------------------------------------------------
----------------------
Problem
statement-------------------------------------------------------------------------------
---------------------
Hardware
Requirements--------------------------------------------------------------------------
-------------------------------------------
Software
Requirements--------------------------------------------------------------------------
-------------------------------------------
Psesudo
Code------------------------------------------------------------------------------
--------------------------------------------------
Tools and
Technology-----------------------------------------------------------------------------
-------------------------------------
Proposed System design (UML)Use case
diagram---------------------------------------------------------------Activity
diagram Class diagram--------------------------------------------------------
Application
PROJECT ABSTRAC T
This System is an innovative Application allowing the System to take usage from Build
classes and put a list in front of the user for him to review. The List also
consists of the applications taking the battery usage and also determines the
battery level. If the Battery level is low and the consumption of apps is more
the system will trigger an alarm telling the user to force stop or close the
apps.
This System uses Android Studio as its front end and doesn’t use any backend
as this type of application doesn’t need one since it uses the data from the
phone itself and projects to the user.
So basically the system helps the user to refrain certain apps to consume
more battery power and drain it quickly and user can take some action
Introduction:
Battery Saver, Power Saving, or Power Saving Mode is a feature available on all Android
devices that aims to limit power consumption, so that your battery lasts a little longer until
you get to charge it again. When turned on, this feature can add another hour or two to
how much your battery lasts
The rapid development of technology has led to a shift in how we communicate with the world.
Computers themselves have also changed significantly since their inception, from analogue
machines, to large electromechanical computers and transistor computers. Nowadays, many people
own personal computers, varying from desktops to laptops. In addition, they are also using smaller,
portable computers such as tablets and smartphones. Each iteration of devices enabled us to
accomplish tasks that were previously not possible. The rise of smartphones has enabled us to
remain connec with everything, regardless of our location. They are capable of accessing the
internet, with applications ranging from social media networks to banking services. With over 3
billion users as of June 2014 [1], this technology has affected a significant portion of the world.
However, the smartphone itself was also developed through a series of iterations.
Problem Statement:
The smartphone can be viewed as an extension of the computer, allowing us to perform the same
tasks on a pocket-sized device. Developers have embraced this medium and created accessible
mobile equivalents of the online services that we use. In addition, they are also creating new,
unique applications by leveraging the variety of sensors on the device. However, they must
compensate for the lack of resources in comparison to traditional computers
Hardware Requirements:
Processor :- i3
Software Requirements:
/**
* Responsible for battery saver mode transition logic.
*
* IMPORTANT: This class shares the power manager lock,
which is very low in the lock hierarchy.
* Do not call out with the lock held. (Settings provider
is okay.)
*/
public class Battery Saver Controller implements Battery
Saver Policy Listener {
static final String TAG = "Battery Saver Controller";
/**
* Do not access directly; always use {@link #set
Adaptive Enabled Locked} and
* {@link #get Adaptive Enabled Locked}.
*/
@Guarded By ("m Lock")
private boolean m Adaptive Enabled Raw;
/**
* Whether full was previously enabled or not; only for
the event logging. Only use it from
* {@ link # handle Battery Saver State Changed}.
*/
private boolean m Full Previously Enabled;
/**
* Whether adaptive was previously enabled or not; only
for the event logging. Only use it from
* {@ link # handle Battery Saver State Changed}.
*/
private boolean m Adaptive Previously Enabled;
/**
* Package name that will receive an explicit manifest
broadcast for
* {@link Power Manager #ACTION_POWER
_SAVE_MODE_CHANGED}. It's {@code null} if it hasn't been
* retrieved yet.
*/
@Null able
private Optional<String> m Power Save Mode Changed
Listener Package;
mHandler.postStateChanged(/*sendBroadcast=*/ false,
REASON_INTERACTIVE_CHANGED);
break;
case Intent.ACTION_BATTERY_CHANGED:
synchronized (mLock) {
mIsPluggedIn =
(intent.getIntExtra(BatteryManager.EXTRA_PLUGGED, 0) != 0);
}
// Fall-through.
case
PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED:
case
PowerManager.ACTION_LIGHT_DEVICE_IDLE_MODE_CHANGED:
updateBatterySavingStats();
break;
}
}
};
/**
* Constructor.
*/
public BatterySaverController(Object lock, Context
context, Looper looper,
BatterySaverPolicy policy, BatterySavingStats
batterySavingStats) {
mLock = lock;
mContext = context;
mHandler = new MyHandler(looper);
mBatterySaverPolicy = policy;
mBatterySaverPolicy.addListener(this);
mBatterySavingStats = batterySavingStats;
PowerManager.invalidatePowerSaveModeCaches();
}
/**
* Add a listener.
*/
public void addListener(LowPowerModeListener listener)
{
synchronized (mLock) {
mListeners.add(listener);
}
}
/**
* Called by {@link PowerManagerService} on system
ready, *with no lock held*.
*/
public void systemReady() {
final IntentFilter filter = new
IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
filter.addAction(PowerManager.ACTION_DEVICE_IDLE_MODE_CHANG
ED);
filter.addAction(PowerManager.ACTION_LIGHT_DEVICE_IDLE_MODE
_CHANGED);
mContext.registerReceiver(mReceiver, filter);
mHandler.postSystemReady();
}
Objects.requireNonNull(mContext.getSystemService(PowerManag
er.class));
}
return mPowerManager;
}
@Override
public void
onBatterySaverPolicyChanged(BatterySaverPolicy policy) {
if (!isPolicyEnabled()) {
return; // No need to send it if not enabled.
}
mHandler.postStateChanged(/*sendBroadcast=*/ true,
REASON_POLICY_CHANGED);
}
private class MyHandler extends Handler {
private static final int MSG_STATE_CHANGED = 1;
@Override
public void dispatchMessage(Message msg) {
switch (msg.what) {
case MSG_STATE_CHANGED:
handleBatterySaverStateChanged(
msg.arg1 == ARG_SEND_BROADCAST,
msg.arg2);
break;
}
}
}
if (updatePolicyLevelLocked()) {
BatterySaverPolicyConfig getPolicyLocked(@PolicyLevel
int policyLevel) {
return
mBatterySaverPolicy.getPolicyLocked(policyLevel).toConfig()
;
}
/**
* @return whether battery saver is enabled or not.
This takes into
* account whether a policy says to advertise isEnabled
so this can be propagated externally.
*/
public boolean isEnabled() {
synchronized (mLock) {
return getFullEnabledLocked() ||
(getAdaptiveEnabledLocked()
&&
mBatterySaverPolicy.shouldAdvertiseIsEnabled());
}
}
/**
* @return whether battery saver policy is enabled or
not. This does not take into account
* whether a policy says to advertise isEnabled, so
this shouldn't be propagated externally.
*/
private boolean isPolicyEnabled() {
synchronized (mLock) {
return getFullEnabledLocked() ||
getAdaptiveEnabledLocked();
}
}
boolean isFullEnabled() {
synchronized (mLock) {
return getFullEnabledLocked();
}
}
boolean setFullPolicyLocked(BatterySaverPolicyConfig
config, int reason) {
return
setFullPolicyLocked(BatterySaverPolicy.Policy.fromConfig(co
nfig), reason);
}
return false;
}
/**
* @return true if launch boost should currently be
disabled.
*/
public boolean is Launch Boost Disabled () {
return is Policy Enabled () && m Battery Saver
Policy. Is Launch Boost Disabled ();
}
/**
* Dispatch power save events to the listeners.
*
* This method is always called on the handler thread.
*
* This method is called only in the following cases:
* - When battery saver becomes activated.
* - When battery saver becomes deactivated.
* - When battery saver is on and the interactive state
changes.
* - When battery saver is on and the battery saver
policy changes.
* - When adaptive battery saver becomes activated.
* - When adaptive battery saver becomes deactivated.
* - When adaptive battery saver is active (and full
is off) and th e policy changes.
*/
void handle Battery Saver State Changed(boolean send
Broadcast, int reason) {
final Low Power Mode Listener[] listeners;
synchronized (m Lock) {
enabled = get Full Enabled Locked() || get
Adaptive Enabled Locked();
m Is Interactive = is Interactive;
}
if (send Broadcast) {
if (DEBUG) {
Slog.i(TAG, "Sending broadcasts for mode: "
+ ());
}
// Send the broadcasts and notify the
listeners. We only do this when the battery saver
// mode changes, but not when only the screen
state changes.
Intent intent = new Intent(Power Manager.
ACTION_ POWER_ SAVE_ MODE_ CHANGED);
Intent. add Flags (Intent. FLAG_
RECEIVER_REGISTERED_ ONLY);
m Context. Send Broadcast As User (intent, User
Handle. ALL);
return;
}
final boolean is Interactive = pm. Is
Interactive();
final int doze Mode =
pm.is Device Idle Mode() ? Doze State. DEEP
: pm. Is Light Device Idle Mode() ?
Doze State. LIGHT
: Doze State. NOT_DOZING;
synchronized (m Lock) {
m Battery Saving Stats. Transition State(
get Full Enabled Locked () ? Battery
Saver State. ON :
(get Adaptive Enabled
Locked() ? Battery Saver State. ADAPTIVE : Battery Saver
State. OFF),
Is Interactive ? Interactive
State. INTERACTIVE :Interactive State. NON_INTERACTIVE,
doze Mode,
m Is Plugged In ? Plug State. PLUGGED :
Plug State. UNPLUGGED);
}
}
Diagram design
(UML):
Class diagram:
Application:
All Android smartphones and tablets have a battery-saving feature that you can activate
manually or automatically to give you a little more time until the battery discharges
completely. This feature has different names (Battery Saver, Power Saving, Power Saving
Mode) depending on the device, Android version, and manufacturer. If you want to save
energy on your device, you don’t need to install a Battery Saver app; all you need to do
is enable and configure the built-in Battery Saver feature on your Android smartphone
or tablet, like this:
Disadvantages
This system doesn’t use any back end This system doesn’t use any backend.
The system provides with less information then the phones build in app.
Advantages:
Conclusion:
Thank You….