If you think the Android project Calma listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright (C) 2013 Thomas Schmid/*www.java2s.com*/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/package com.scto.android.calma.preferences;
/**
* An enumeration of the access modes.
*/publicenum AccessMode implements ObjectStringIdentifier {
/**
* The safe mode. The app runs without privileges and the only accessible filesystem
* are the storage volumes (sdcards and USB).
*/
SAFE("0"), //$NON-NLS-1$
/**
* The prompt user mode. The app runs without privileges, with access to all the filesystem,
* but the user is asked prior to execute a privileged action. If the user accepts then the
* system change to a {@link AccessMode#ROOT} mode, and continues in it after execute the
* action.
*/
PROMPT("1"), //$NON-NLS-1$
/**
* the root mode. The app runs with all privileges.
*/
ROOT("2"); //$NON-NLS-1$
private String mId;
/**
* Constructor of <code>AccessMode</code>.
*
* @param id The unique identifier of the enumeration
*/private AccessMode(String id) {
this.mId = id;
}
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return this.mId;
}
/**
* Method that returns an instance of {@link AccessMode} from its
* unique identifier.
*
* @param id The unique identifier
* @return AccessMode The access mode
*/publicstatic AccessMode fromId(String id) {
AccessMode[] values = values();
int cc = values.length;
for (int i = 0; i < cc; i++) {
if (values[i].mId.compareTo(id) == 0) {
return values[i];
}
}
return null;
}
}