Android Open Source - androiddevice.info System Property






From Project

Back to project page androiddevice.info.

License

The source code is released under:

GNU General Public License

If you think the Android project androiddevice.info 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

package name.unused.android.utils.systemproperties;
/*w w w  .ja va2  s  .  com*/
import android.content.Context;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import name.unused.android.utils.systemproperties.exception.NoSuchPropertyException;

public class SystemProperty {
    private final Context mContext;

    public SystemProperty(Context mContext) {
        this.mContext = mContext;
    }

    public String getOrThrow(String key) throws NoSuchPropertyException {
        try {
            ClassLoader classLoader = mContext.getClassLoader();
            Class SystemProperties = classLoader.loadClass("android.os.SystemProperties");
            Method methodGet = SystemProperties.getMethod("get", String.class);
            return (String) methodGet.invoke(SystemProperties, key);
        } catch (ClassNotFoundException e) {
            throw new NoSuchPropertyException(e);
        } catch (NoSuchMethodException e) {
            throw new NoSuchPropertyException(e);
        } catch (InvocationTargetException e) {
            throw new NoSuchPropertyException(e);
        } catch (IllegalAccessException e) {
            throw new NoSuchPropertyException(e);
        }
    }

    public String get(String key) {
        try {
            return getOrThrow(key);
        } catch (NoSuchPropertyException e) {
            return null;
        }
    }

}




Java Source Code List

android.system.ErrnoException.java
android.system.Os.java
android.system.StructStat.java
info.androiddevice.deviceinventory.Application.java
info.androiddevice.deviceinventory.DeviceInformation.java
info.androiddevice.deviceinventory.Error.java
info.androiddevice.deviceinventory.info.CpuinfoProperty.java
info.androiddevice.deviceinventory.info.DirProperty.java
info.androiddevice.deviceinventory.info.DisplayProperty.java
info.androiddevice.deviceinventory.info.EnvironmentProperty.java
info.androiddevice.deviceinventory.info.FeaturesProperty.java
info.androiddevice.deviceinventory.info.FileProperty.java
info.androiddevice.deviceinventory.info.GetPropProperty.java
info.androiddevice.deviceinventory.info.JavaSystemProperty.java
info.androiddevice.deviceinventory.info.MeminfoProperty.java
info.androiddevice.deviceinventory.info.MountsProperty.java
info.androiddevice.deviceinventory.info.NameProperty.java
info.androiddevice.deviceinventory.info.OtacertsProperty.java
info.androiddevice.deviceinventory.info.PackageSigProperty.java
info.androiddevice.deviceinventory.info.Property.java
info.androiddevice.deviceinventory.info.SharedLibraryNamesProperty.java
info.androiddevice.deviceinventory.info.UsbProperty.java
info.androiddevice.deviceinventory.info.Utils.java
info.androiddevice.deviceinventory.info.VersionProperty.java
info.androiddevice.deviceinventory.submission.DeviceInformationListAdapter.java
info.androiddevice.deviceinventory.submission.MainActivity.java
libcore.io.ErrnoException.java
libcore.io.Libcore.java
libcore.io.Os.java
libcore.io.StructStat.java
name.unused.android.utils.systemproperties.SystemProperty.java
name.unused.android.utils.systemproperties.exception.NoSuchPropertyException.java