Commit 71d15c2b authored by Mark Stevens's avatar Mark Stevens
Browse files

update to duco/rk 3128-6003-6.0

parent 9a6c747a
# NFCNCIHAL_base
####Git Repository
| DESCRIPTION | CHECKOUT COMMAND |
| :-------------: |:-------------:|
| NFCNCIHAL_base | git clone https://github.com/NXPNFCProject/NFC_NCIHAL_base.git |
####Supported Versions on "master" Branch
| Android Version | NXP Release | NXP Tag |
| :-------------: |:-------------:| :-----:|
| android-5.0.0_r1/android5.1.0_r1 | 3.5.0_L (PN547C2/PN548C2) | NFC_NCIHALx_AR0F.3.5.0_L_OpnSrc |
####Supported Versions on "br_android_ncihalx_m" Branch
| Android Version | NXP Release | NXP Tag |
| :-------------: |:-------------:| :-----:|
| android-6.0.0_r1 | 4.2.0_M (PN547C2/PN548C2) | NFC_NCIHALx_AR0F.4.2.0_M_OpnSrc |
| android-6.0.0_r1 | 4.3.0_M (PN547C2/PN548C2) | NFC_NCIHALx_AR0F.4.3.0_M_OpnSrc |
| android-6.0.1_r17 | 4.5.0_M (PN551/PN548C2) | NFC_NCIHALx_AR3C.4.5.0_M_OpnSrc |
| android-6.0.1_r17 | 4.7.0_M (PN553) | NFC_NCIHALx_ARC0.4.7.0_M_OpnSrc |
####Supported Versions on "br_android_ncihalx_n" Branch
| Android Version | NXP Release | NXP Tag |
| :-------------: |:-------------:| :-----:|
| android-7.0.0_r1 | 7.0.3_N (PN548C2/PN551) | NFC_NCIHALx_AR3C.7.0.3_N_OpnSrc |
//$_FOR_ROCKCHIP_RBOX_$
/**$_rbox_$_modify_$_chenxiao*/
//$_rbox_$_modify_$_begin
/*******************************************************************
* Company: Fuzhou Rockchip Electronics Co., Ltd
* Filename: ISensorManager
* Description:
* @author: fxw@rock-chips.com
* Create at: 2011-12-17 01:03:04
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2011-12-17 xwf 1.0 create
*******************************************************************/
package android.hardware;
import android.hardware.SensorParcel;
/**
* System private interface to the remote sensor manager.
*
* {@hide}
*/
interface ISensorManager {
int getRemoteSensorType();
SensorParcel obtainSensorEvent(int queue);
int createSensorQueue();
void destroySensorQueue(int queue);
}
//$_rbox_$_modify_$_end
//$_FOR_ROCKCHIP_RBOX_$
/**$_rbox_$_modify_$_chenxiao*/
//$_rbox_$_modify_$_begin
/* //device/java/android/android.view.KeyEvent.aidl
**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package android.hardware;
parcelable SensorParcel;
//$_rbox_$_modify_$_end
//$_FOR_ROCKCHIP_RBOX_$
/*$_rbox_$_modify_$_chenxiao*/
//$_rbox_$_modify_$_begin
/*******************************************************************
* Company: Fuzhou Rockchip Electronics Co., Ltd
* Filename: SensorParcel.java
* Description:
* @author: fxw@rock-chips.com
* Create at: 2011-12-17
*
* Modification History:
* Date Author Version Description
* ------------------------------------------------------------------
* 2011-12-17 xwf 1.0 create
*******************************************************************/
package android.hardware;
import android.os.Parcel;
import android.os.Parcelable;
public class SensorParcel implements Parcelable {
public float[] values;
public int accuracy;
public long timestamp;
public int sensorType;
/**
* <p>Title: describeContents</p>
* <p>Description: </p>
* @return
* @see android.os.Parcelable#describeContents()
*/
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeFloatArray(values);
dest.writeInt(accuracy);
dest.writeLong(timestamp);
dest.writeInt(sensorType);
}
public static final Parcelable.Creator<SensorParcel> CREATOR = new Creator<SensorParcel>() {
@Override
public SensorParcel createFromParcel(Parcel source) {
SensorParcel sensor = new SensorParcel();
float[] values = new float[3];
source.readFloatArray(values);
sensor.values = values;
sensor.accuracy = source.readInt();
sensor.timestamp = source.readLong();
sensor.sensorType = source.readInt();
return sensor;
}
@Override
public SensorParcel[] newArray(int size) {
return new SensorParcel[size];
}
};
}
//$_rbox_$_modify_$_end
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net.pppoe;
/**
* Interface that answers queries about, and allows changing
* ethernet configuration.
*/
/** {@hide} */
interface IPppoeManager
{
int getPppoeState();
boolean setupPppoe(String user, String iface, String dns1, String dns2, String password);
boolean startPppoe();
boolean stopPppoe();
String getPppoePhyIface();
}
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net.pppoe;
/**
* Interface that answers queries about, and allows changing
* ethernet configuration.
*/
/** {@hide} */
interface IPppoeManager
{
int getPppoeState();
boolean setupPppoe(String user, String iface, String dns1, String dns2, String password);
boolean startPppoe();
boolean stopPppoe();
String getPppoePhyIface();
}
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net.pppoe;
import android.content.Context;
import android.os.RemoteException;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.net.DhcpInfo;
import android.os.Binder;
import android.os.IBinder;
import android.os.Handler;
import android.os.Message;
import android.os.Looper;
import android.os.HandlerThread;
import android.os.RemoteException;
import android.util.Log;
/**
* A class to control the pppoe network.
*
* @hide
*/
public class PppoeManager {
private static final String TAG = "PppoeManager";
private final Context mContext;
private final IPppoeManager mService;
private PppoeHandler mPppoeHandler;
public static boolean DEBUG=true;
private static void LOG(String msg) {
if ( DEBUG ) {
Log.d(TAG, msg);
}
}
/**
* @hide
*/
public static final String EXTRA_PPPOE_ERRMSG = "pppoe_errmsg";
/**
* @hide
*/
public static final String PPPOE_STATE_CHANGED_ACTION = "android.net.pppoe.PPPOE_STATE_CHANGED";
/**
* @hide
*/
public static final String EXTRA_PPPOE_STATE = "pppoe_state";
/**
* @hide
*/
public static final String EXTRA_PREVIOUS_PPPOE_STATE = "previous_pppoe_state";
/**
* @hide
*/
public static final int PPPOE_STATE_UNKNOWN = 4;
/**
* @hide
*/
public static final int PPPOE_STATE_DISCONNECTED = 3;
/**
* @hide
*/
public static final int PPPOE_STATE_DISCONNECTING = 2;
/**
* @hide
*/
public static final int PPPOE_STATE_CONNECTED = 1;
/**
* @hide
*/
public static final int PPPOE_STATE_CONNECTING = 0;
/**
*/
public PppoeManager(Context context, IPppoeManager service) {
mContext = context;
mService = service;
}
private void ensurePppoeHandlerStart() {
if ( null == mPppoeHandler ) {
LOG("PppoeManager() : start 'pppoe handle thread'.");
HandlerThread handleThread = new HandlerThread("Pppoe Handler Thread");
handleThread.start();
mPppoeHandler = new PppoeHandler(handleThread.getLooper()/*, this*/);
}
}
private class PppoeHandler extends Handler {
private static final int COMMAND_START_PPPOE = 1;
private static final int COMMAND_STOP_PPPOE = 2;
private Handler mTarget;
public PppoeHandler(Looper looper) {
super(looper);
}
public void handleMessage(Message msg) {
int event;
LOG("PppoeHandler::handleMessage() : Entered : msg = " + msg);
switch (msg.what) {
case COMMAND_START_PPPOE:
try {
mService.startPppoe();
} catch (RemoteException e) {
Log.e(TAG, "startPppoe failed");
}
break;
case COMMAND_STOP_PPPOE:
try {
mService.stopPppoe();
} catch (RemoteException e) {
Log.e(TAG, "stopPppoe failed");
}
break;
default:
break;
}
}
}
public boolean setupPppoe(String user, String iface, String dns1, String dns2, String password) {
try {
return mService.setupPppoe(user, iface, dns1, dns2, password);
} catch (RemoteException e) {
return false;
}
}
public boolean startPppoe() {
ensurePppoeHandlerStart();
return mPppoeHandler.sendEmptyMessage(PppoeHandler.COMMAND_START_PPPOE);
}
public boolean stopPppoe() {
ensurePppoeHandlerStart();
return mPppoeHandler.sendEmptyMessage(PppoeHandler.COMMAND_STOP_PPPOE);
}
public String getPppoePhyIface() {
try {
return mService.getPppoePhyIface();
} catch (RemoteException e) {
return null;
}
}
public int getPppoeState() {
try {
return mService.getPppoeState();
} catch (RemoteException e) {
Log.e(TAG, "stopPppoe failed");
return -1;
}
}
}
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc;
import android.content.ComponentName;
import android.nfc.cardemulation.NfcFServiceInfo;
/**
* @hide
*/
interface INfcFCardEmulation
{
String getSystemCodeForService(int userHandle, in ComponentName service);
boolean registerSystemCodeForService(int userHandle, in ComponentName service, String systemCode);
boolean removeSystemCodeForService(int userHandle, in ComponentName service);
String getNfcid2ForService(int userHandle, in ComponentName service);
boolean setNfcid2ForService(int userHandle, in ComponentName service, String nfcid2);
boolean enableNfcFForegroundService(in ComponentName service);
boolean disableNfcFForegroundService();
List<NfcFServiceInfo> getNfcFServices(int userHandle);
int getMaxNumOfRegisterableSystemCodes();
}
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc.cardemulation;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
/**
* <p>HostNfcFService is a convenience {@link Service} class that can be
* extended to emulate an NFC-F card inside an Android service component.
*/
public abstract class HostNfcFService extends Service {
/**
* The {@link Intent} action that must be declared as handled by the service.
*/
@SdkConstant(SdkConstantType.SERVICE_ACTION)
public static final String SERVICE_INTERFACE =
"android.nfc.cardemulation.action.HOST_NFCF_SERVICE";
/**
* The name of the meta-data element that contains
* more information about this service.
*/
public static final String SERVICE_META_DATA =
"android.nfc.cardemulation.host_nfcf_service";
/**
* Reason for {@link #onDeactivated(int)}.
* Indicates deactivation was due to the NFC link
* being lost.
*/
public static final int DEACTIVATION_LINK_LOSS = 0;
static final String TAG = "NfcFService";
/**
* MSG_COMMAND_PACKET is sent by NfcService when
* a NFC-F command packet has been received.
*
* @hide
*/
public static final int MSG_COMMAND_PACKET = 0;
/**
* MSG_RESPONSE_PACKET is sent to NfcService to send
* a response packet back to the remote device.
*
* @hide
*/
public static final int MSG_RESPONSE_PACKET = 1;
/**
* MSG_DEACTIVATED is sent by NfcService when
* the current session is finished; because
* the NFC link was deactivated.
*
* @hide
*/
public static final int MSG_DEACTIVATED = 2;
/**
* @hide
*/
public static final String KEY_DATA = "data";
/**
* @hide
*/
public static final String KEY_MESSENGER = "messenger";
/**
* Messenger interface to NfcService for sending responses.
* Only accessed on main thread by the message handler.
*
* @hide
*/
Messenger mNfcService = null;
final Messenger mMessenger = new Messenger(new MsgHandler());
final class MsgHandler extends Handler {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_COMMAND_PACKET:
Bundle dataBundle = msg.getData();
if (dataBundle == null) {
return;
}
if (mNfcService == null) mNfcService = msg.replyTo;
byte[] packet = dataBundle.getByteArray(KEY_DATA);
if (packet != null) {
byte[] responsePacket = processNfcFPacket(packet, null);
/* Comment for handle Empty DATA packet*/
//if (responsePacket != null) {
if (mNfcService == null) {
Log.e(TAG, "Response not sent; service was deactivated.");
return;
}
Message responseMsg = Message.obtain(null, MSG_RESPONSE_PACKET);
Bundle responseBundle = new Bundle();
responseBundle.putByteArray(KEY_DATA, responsePacket);
responseMsg.setData(responseBundle);
responseMsg.replyTo = mMessenger;
try {
mNfcService.send(responseMsg);
} catch (RemoteException e) {
Log.e("TAG", "Response not sent; RemoteException calling into " +
"NfcService.");
}
//} else {
// Log.e(TAG, "Received MSG_COMMAND_PACKET without data.");
// }
} else {
Log.e(TAG, "Received MSG_COMMAND_PACKET without data.");
}
break;
case MSG_RESPONSE_PACKET:
if (mNfcService == null) {
Log.e(TAG, "Response not sent; service was deactivated.");
return;
}
try {
msg.replyTo = mMessenger;
mNfcService.send(msg);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling into NfcService.");
}
break;
case MSG_DEACTIVATED:
// Make sure we won't call into NfcService again
mNfcService = null;
onDeactivated(msg.arg1);
break;
default:
super.handleMessage(msg);
}
}
}
@Override
public final IBinder onBind(Intent intent) {
return mMessenger.getBinder();
}
/**
* Sends a response packet back to the remote device.
*
* <p>Note: this method may be called from any thread and will not block.
* @param responsePacket A byte-array containing the response packet.
*/
public final void sendResponsePacket(byte[] responsePacket) {
Message responseMsg = Message.obtain(null, MSG_RESPONSE_PACKET);
Bundle dataBundle = new Bundle();
dataBundle.putByteArray(KEY_DATA, responsePacket);
responseMsg.setData(dataBundle);
try {
mMessenger.send(responseMsg);
} catch (RemoteException e) {
Log.e("TAG", "Local messenger has died.");
}
}
/**
* <p>This method will be called when a NFC-F packet has been received
* from a remote device. A response packet can be provided directly
* by returning a byte-array in this method. Note that in general
* response packets must be sent as quickly as possible, given the fact
* that the user is likely holding his device over an NFC reader
* when this method is called.
*
* <p class="note">This method is running on the main thread of your application.
* If you cannot return a response packet immediately, return null
* and use the {@link #sendResponsePacket(byte[])} method later.
*
* @param commandPacket The NFC-F packet that was received from the remote device
* @param extras A bundle containing extra data. May be null.
* @return a byte-array containing the response packet, or null if no
* response packet can be sent at this point.
*/
public abstract byte[] processNfcFPacket(byte[] commandPacket, Bundle extras);
/**
* This method will be called in following possible scenarios:
* <li>The NFC link has been lost
* @param reason {@link #DEACTIVATION_LINK_LOSS}
*/
public abstract void onDeactivated(int reason);
}
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc.cardemulation;
import android.app.Activity;
import android.app.ActivityThread;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.nfc.INfcFCardEmulation;
import android.nfc.NfcAdapter;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
/**
* This class can be used to query the state of
* NFC-F card emulation services.
*
* For a general introduction into NFC card emulation,
* please read the <a href="{@docRoot}guide/topics/connectivity/nfc/hce.html">
* NFC card emulation developer guide</a>.</p>
*
* <p class="note">Use of this class requires the
* {@link PackageManager#FEATURE_NFC_HOST_CARD_EMULATION_NFCF}
* to be present on the device.
*/
public final class NfcFCardEmulation {
static final String TAG = "NfcFCardEmulation";
static boolean sIsInitialized = false;
static HashMap<Context, NfcFCardEmulation> sCardEmus = new HashMap<Context, NfcFCardEmulation>();
static INfcFCardEmulation sService;
final Context mContext;
private NfcFCardEmulation(Context context, INfcFCardEmulation service) {
mContext = context.getApplicationContext();
sService = service;
}
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null) throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
/**
* Retrieves the current System Code for the specified service.
*
* <p>Before calling {@link #registerSystemCodeForService(ComponentName, String)},
* the System Code contained in the Manifest file is returned. After calling
* {@link #registerSystemCodeForService(ComponentName, String)}, the System Code
* registered there is returned. After calling
* {@link #removeSystemCodeForService(ComponentName)}, "null" is returned.
*
* @param service The component name of the service
* @return the current System Code
*/
public String getSystemCodeForService(ComponentName service) {
if (service == null) {
throw new NullPointerException("service is null");
}
try {
return sService.getSystemCodeForService(UserHandle.myUserId(), service);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return null;
}
try {
return sService.getSystemCodeForService(UserHandle.myUserId(), service);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return null;
}
}
}
/**
* Registers a System Code for the specified service.
*
* <p>The System Code must be in range from "4000" to "4FFF" (excluding "4*FF").
*
* <p>If a System Code was previously registered for this service
* (either statically through the manifest, or dynamically by using this API),
* it will be replaced with this one.
*
* <p>Even if the same System Code is already registered for another service,
* this method succeeds in registering the System Code.
*
* <p>Note that you can only register a System Code for a service that
* is running under the same UID as the caller of this API. Typically
* this means you need to call this from the same
* package as the service itself, though UIDs can also
* be shared between packages using shared UIDs.
*
* @param service The component name of the service
* @param systemCode The System Code to be registered
* @return whether the registration was successful.
*/
public boolean registerSystemCodeForService(ComponentName service, String systemCode) {
if (service == null || systemCode == null) {
throw new NullPointerException("service or systemCode is null");
}
try {
return sService.registerSystemCodeForService(UserHandle.myUserId(),
service, systemCode);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return false;
}
try {
return sService.registerSystemCodeForService(UserHandle.myUserId(),
service, systemCode);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return false;
}
}
}
/**
* Removes a registered System Code for the specified service.
*
* @param service The component name of the service
* @return whether the System Code was successfully removed.
*/
public boolean removeSystemCodeForService(ComponentName service) {
if (service == null) {
throw new NullPointerException("service is null");
}
try {
return sService.removeSystemCodeForService(UserHandle.myUserId(), service);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return false;
}
try {
return sService.removeSystemCodeForService(UserHandle.myUserId(), service);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return false;
}
}
}
/**
* Retrieves the current NFCID2 for the specified service.
*
* <p>Before calling {@link #setNfcid2ForService(ComponentName, String)},
* the NFCID2 contained in the Manifest file is returned. If "random" is specified
* in the Manifest file, a random number assigned by the system at installation time
* is returned. After setting an NFCID2
* with {@link #setNfcid2ForService(ComponentName, String)}, this NFCID2 is returned.
*
* @param service The component name of the service
* @return the current NFCID2
*/
public String getNfcid2ForService(ComponentName service) {
if (service == null) {
throw new NullPointerException("service is null");
}
try {
return sService.getNfcid2ForService(UserHandle.myUserId(), service);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return null;
}
try {
return sService.getNfcid2ForService(UserHandle.myUserId(), service);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return null;
}
}
}
/**
* Set a NFCID2 for the specified service.
*
* <p>The NFCID2 must be in range from "02FE000000000000" to "02FEFFFFFFFFFFFF".
*
* <p>If a NFCID2 was previously set for this service
* (either statically through the manifest, or dynamically by using this API),
* it will be replaced.
*
* <p>Note that you can only set the NFCID2 for a service that
* is running under the same UID as the caller of this API. Typically
* this means you need to call this from the same
* package as the service itself, though UIDs can also
* be shared between packages using shared UIDs.
*
* @param service The component name of the service
* @param nfcid2 The NFCID2 to be registered
* @return whether the setting was successful.
*/
public boolean setNfcid2ForService(ComponentName service, String nfcid2) {
if (service == null || nfcid2 == null) {
throw new NullPointerException("service or nfcid2 is null");
}
try {
return sService.setNfcid2ForService(UserHandle.myUserId(),
service, nfcid2);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return false;
}
try {
return sService.setNfcid2ForService(UserHandle.myUserId(),
service, nfcid2);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return false;
}
}
}
/**
* Allows a foreground application to specify which card emulation service
* should be enabled while a specific Activity is in the foreground.
*
* <p>The specified HCE-F service is only enabled when the corresponding application is
* in the foreground and this method has been called. When the application is moved to
* the background, {@link #disableNfcFForegroundService(Activity)} is called, or
* NFCID2 or System Code is replaced, the HCE-F service is disabled.
*
* <p>The specified Activity must currently be in resumed state. A good
* paradigm is to call this method in your {@link Activity#onResume}, and to call
* {@link #disableNfcFForegroundService(Activity)} in your {@link Activity#onPause}.
*
* <p>Note that this preference is not persisted by the OS, and hence must be
* called every time the Activity is resumed.
*
* @param activity The activity which prefers this service to be invoked
* @param service The service to be preferred while this activity is in the foreground
* @return whether the registration was successful
*/
public boolean enableNfcFForegroundService(Activity activity, ComponentName service) {
if (activity == null || service == null) {
throw new NullPointerException("activity or service is null");
}
// Verify the activity is in the foreground before calling into NfcService
if (!activity.isResumed()) {
throw new IllegalArgumentException("Activity must be resumed.");
}
try {
return sService.enableNfcFForegroundService(service);
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return false;
}
try {
return sService.enableNfcFForegroundService(service);
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return false;
}
}
}
/**
* Disables the service for the specified Activity.
*
* <p>Note that the specified Activity must still be in resumed
* state at the time of this call. A good place to call this method
* is in your {@link Activity#onPause} implementation.
*
* @param activity The activity which the service was registered for
* @return true when successful
*/
public boolean disableNfcFForegroundService(Activity activity) {
if (activity == null) {
throw new NullPointerException("activity is null");
}
if (!activity.isResumed()) {
throw new IllegalArgumentException("Activity must be resumed.");
}
try {
return sService.disableNfcFForegroundService();
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return false;
}
try {
return sService.disableNfcFForegroundService();
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return false;
}
}
}
/**
* @hide
*/
public List<NfcFServiceInfo> getNfcFServices() {
try {
return sService.getNfcFServices(UserHandle.myUserId());
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return null;
}
try {
return sService.getNfcFServices(UserHandle.myUserId());
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return null;
}
}
}
/**
* @hide
*/
public int getMaxNumOfRegisterableSystemCodes() {
try {
return sService.getMaxNumOfRegisterableSystemCodes();
} catch (RemoteException e) {
// Try one more time
recoverService();
if (sService == null) {
Log.e(TAG, "Failed to recover CardEmulationService.");
return -1;
}
try {
return sService.getMaxNumOfRegisterableSystemCodes();
} catch (RemoteException ee) {
Log.e(TAG, "Failed to reach CardEmulationService.");
return -1;
}
}
}
/**
* @hide
*/
public static boolean isValidSystemCode(String systemCode) {
if (systemCode == null) {
return false;
}
if (systemCode.length() != 4) {
Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
return false;
}
// check if the value is between "4000" and "4FFF" (excluding "4*FF")
if (!systemCode.startsWith("4") || systemCode.toUpperCase().endsWith("FF")) {
Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
return false;
}
try {
Integer.valueOf(systemCode, 16);
} catch (NumberFormatException e) {
Log.e(TAG, "System Code " + systemCode + " is not a valid System Code.");
return false;
}
return true;
}
/**
* @hide
*/
public static boolean isValidNfcid2(String nfcid2) {
if (nfcid2 == null) {
return false;
}
if (nfcid2.length() != 16) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
// check if the the value starts with "02FE"
if (!nfcid2.toUpperCase().startsWith("02FE")) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
try {
Long.parseLong(nfcid2, 16);
} catch (NumberFormatException e) {
Log.e(TAG, "NFCID2 " + nfcid2 + " is not a valid NFCID2.");
return false;
}
return true;
}
void recoverService() {
NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
sService = adapter.getNfcFCardEmulationService();
}
}
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc.cardemulation;
parcelable NfcFServiceInfo;
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.nfc.cardemulation;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.FileDescriptor;
import java.io.IOException;
import java.io.PrintWriter;
/**
* @hide
*/
public final class NfcFServiceInfo implements Parcelable {
static final String TAG = "NfcFServiceInfo";
/**
* The service that implements this
*/
final ResolveInfo mService;
/**
* Description of the service
*/
final String mDescription;
/**
* System Code of the service
*/
final String mSystemCode;
/**
* System Code of the service registered by API
*/
String mDynamicSystemCode;
/**
* NFCID2 of the service
*/
final String mNfcid2;
/**
* NFCID2 of the service registered by API
*/
String mDynamicNfcid2;
/**
* The uid of the package the service belongs to
*/
final int mUid;
/**
* @hide
*/
public NfcFServiceInfo(ResolveInfo info, String description,
String systemCode, String dynamicSystemCode, String nfcid2, String dynamicNfcid2,
int uid) {
this.mService = info;
this.mDescription = description;
this.mSystemCode = systemCode;
this.mDynamicSystemCode = dynamicSystemCode;
this.mNfcid2 = nfcid2;
this.mDynamicNfcid2 = dynamicNfcid2;
this.mUid = uid;
}
public NfcFServiceInfo(PackageManager pm, ResolveInfo info)
throws XmlPullParserException, IOException {
ServiceInfo si = info.serviceInfo;
XmlResourceParser parser = null;
try {
parser = si.loadXmlMetaData(pm, HostNfcFService.SERVICE_META_DATA);
if (parser == null) {
throw new XmlPullParserException("No " + HostNfcFService.SERVICE_META_DATA +
" meta-data");
}
int eventType = parser.getEventType();
while (eventType != XmlPullParser.START_TAG &&
eventType != XmlPullParser.END_DOCUMENT) {
eventType = parser.next();
}
String tagName = parser.getName();
if (!"host-nfcf-service".equals(tagName)) {
throw new XmlPullParserException(
"Meta-data does not start with <host-nfcf-service> tag");
}
Resources res = pm.getResourcesForApplication(si.applicationInfo);
AttributeSet attrs = Xml.asAttributeSet(parser);
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.HostNfcFService);
mService = info;
mDescription = sa.getString(
com.android.internal.R.styleable.HostNfcFService_description);
mDynamicSystemCode = null;
mDynamicNfcid2 = null;
sa.recycle();
String systemCode = null;
String nfcid2 = null;
final int depth = parser.getDepth();
while (((eventType = parser.next()) != XmlPullParser.END_TAG ||
parser.getDepth() > depth) && eventType != XmlPullParser.END_DOCUMENT) {
tagName = parser.getName();
if (eventType == XmlPullParser.START_TAG &&
"system-code-filter".equals(tagName) && systemCode == null) {
final TypedArray a = res.obtainAttributes(attrs,
com.android.internal.R.styleable.SystemCodeFilter);
systemCode = a.getString(
com.android.internal.R.styleable.SystemCodeFilter_name).toUpperCase();
Log.e(TAG, "systemCode: " + systemCode);
if (!NfcFCardEmulation.isValidSystemCode(systemCode) &&
!systemCode.equalsIgnoreCase("NULL")) {
Log.e(TAG, "Invalid System Code: " + systemCode);
systemCode = null;
}
a.recycle();
} else if (eventType == XmlPullParser.START_TAG &&
"nfcid2-filter".equals(tagName) && nfcid2 == null) {
final TypedArray a = res.obtainAttributes(attrs,
com.android.internal.R.styleable.Nfcid2Filter);
nfcid2 = a.getString(
com.android.internal.R.styleable.Nfcid2Filter_name).toUpperCase();
if (!nfcid2.equalsIgnoreCase("RANDOM") &&
!nfcid2.equalsIgnoreCase("NULL") &&
!NfcFCardEmulation.isValidNfcid2(nfcid2)) {
Log.e(TAG, "Invalid NFCID2: " + nfcid2);
nfcid2 = null;
}
a.recycle();
}
}
mSystemCode = (systemCode == null ? "NULL" : systemCode);
mNfcid2 = (nfcid2 == null ? "NULL" : nfcid2);
} catch (NameNotFoundException e) {
throw new XmlPullParserException("Unable to create context for: " + si.packageName);
} finally {
if (parser != null) parser.close();
}
// Set uid
mUid = si.applicationInfo.uid;
}
public ComponentName getComponent() {
return new ComponentName(mService.serviceInfo.packageName,
mService.serviceInfo.name);
}
public String getSystemCode() {
return (mDynamicSystemCode == null ? mSystemCode : mDynamicSystemCode);
}
public void setOrReplaceDynamicSystemCode(String systemCode) {
mDynamicSystemCode = systemCode;
}
public String getNfcid2() {
return (mDynamicNfcid2 == null ? mNfcid2 : mDynamicNfcid2);
}
public void setOrReplaceDynamicNfcid2(String nfcid2) {
mDynamicNfcid2 = nfcid2;
}
public String getDescription() {
return mDescription;
}
public int getUid() {
return mUid;
}
public CharSequence loadLabel(PackageManager pm) {
return mService.loadLabel(pm);
}
public Drawable loadIcon(PackageManager pm) {
return mService.loadIcon(pm);
}
@Override
public String toString() {
StringBuilder out = new StringBuilder("NfcFService: ");
out.append(getComponent());
out.append(", description: " + mDescription);
out.append(", System Code: " + mSystemCode);
if (mDynamicSystemCode != null) {
out.append(", dynamic System Code: " + mDynamicSystemCode);
}
out.append(", NFCID2: " + mNfcid2);
if (mDynamicNfcid2 != null) {
out.append(", dynamic NFCID2: " + mDynamicNfcid2);
}
return out.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof NfcFServiceInfo)) return false;
NfcFServiceInfo thatService = (NfcFServiceInfo) o;
if (!thatService.getComponent().equals(this.getComponent())) return false;
if (!thatService.mSystemCode.equalsIgnoreCase(this.mSystemCode)) return false;
if (!thatService.mNfcid2.equalsIgnoreCase(this.mNfcid2)) return false;
return true;
}
@Override
public int hashCode() {
return getComponent().hashCode();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
mService.writeToParcel(dest, flags);
dest.writeString(mDescription);
dest.writeString(mSystemCode);
dest.writeInt(mDynamicSystemCode != null ? 1 : 0);
if (mDynamicSystemCode != null) {
dest.writeString(mDynamicSystemCode);
}
dest.writeString(mNfcid2);
dest.writeInt(mDynamicNfcid2 != null ? 1 : 0);
if (mDynamicNfcid2 != null) {
dest.writeString(mDynamicNfcid2);
}
dest.writeInt(mUid);
};
public static final Parcelable.Creator<NfcFServiceInfo> CREATOR =
new Parcelable.Creator<NfcFServiceInfo>() {
@Override
public NfcFServiceInfo createFromParcel(Parcel source) {
ResolveInfo info = ResolveInfo.CREATOR.createFromParcel(source);
String description = source.readString();
String systemCode = source.readString();
String dynamicSystemCode = null;
if (source.readInt() != 0) {
dynamicSystemCode = source.readString();
}
String nfcid2 = source.readString();
String dynamicNfcid2 = null;
if (source.readInt() != 0) {
dynamicNfcid2 = source.readString();
}
int uid = source.readInt();
NfcFServiceInfo service = new NfcFServiceInfo(info, description,
systemCode, dynamicSystemCode, nfcid2, dynamicNfcid2, uid);
return service;
}
@Override
public NfcFServiceInfo[] newArray(int size) {
return new NfcFServiceInfo[size];
}
};
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(" " + getComponent() +
" (Description: " + getDescription() + ")");
pw.println(" System Code: " + getSystemCode());
pw.println(" NFCID2: " + getNfcid2());
}
}
/* $_FOR_ROCKCHIP_RBOX_$ */
//$_rbox_$_modify_$_zhengyang_20120220: Rbox android display manager class
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.os;
import android.content.Context;
import android.os.IBinder;
import android.os.IDisplayDeviceManagementService;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.util.Log;
import android.view.IWindowManager;
import android.view.Display;
import android.graphics.Rect;
/**
* @hide
*/
public class DisplayOutputManager {
private static final String TAG = "DisplayOutputManager";
private final boolean DBG = true;
public final int MAIN_DISPLAY = 0;
public final int AUX_DISPLAY = 1;
public final int DISPLAY_IFACE_TV = 1;
public final int DISPLAY_IFACE_YPbPr = 2;
public final int DISPLAY_IFACE_VGA = 3;
public final int DISPLAY_IFACE_HDMI = 4;
public final int DISPLAY_IFACE_LCD = 5;
private final String DISPLAY_TYPE_TV = "TV";
private final String DISPLAY_TYPE_YPbPr = "YPbPr";
private final String DISPLAY_TYPE_VGA = "VGA";
private final String DISPLAY_TYPE_HDMI = "HDMI";
private final String DISPLAY_TYPE_LCD = "LCD";
public final int DISPLAY_OVERSCAN_X = 0;
public final int DISPLAY_OVERSCAN_Y = 1;
public final int DISPLAY_OVERSCAN_LEFT = 2;
public final int DISPLAY_OVERSCAN_RIGHT = 3;
public final int DISPLAY_OVERSCAN_TOP = 4;
public final int DISPLAY_OVERSCAN_BOTTOM = 5;
public final int DISPLAY_OVERSCAN_ALL = 6;
public final int DISPLAY_3D_NONE = -1;
public final int DISPLAY_3D_FRAME_PACKING = 0;
public final int DISPLAY_3D_TOP_BOTTOM = 6;
public final int DISPLAY_3D_SIDE_BY_SIDE_HALT = 8;
private int m_main_iface[] = null;
private int m_aux_iface[] = null;
private IDisplayDeviceManagementService mService;
private IWindowManager mWM;
/**
* @throws RemoteException
* @hide
*/
public DisplayOutputManager() throws RemoteException {
IBinder b = ServiceManager.getService("display_device_management");
if(b == null) {
Log.e(TAG, "Unable to connect to display device management service! - is it running yet?");
return;
}
mWM = IWindowManager.Stub.asInterface(ServiceManager.checkService(
Context.WINDOW_SERVICE));
mService = IDisplayDeviceManagementService.Stub.asInterface(b);
try {
// Get main display interface
String[] display_iface = mService.listInterfaces(MAIN_DISPLAY);
if(DBG) Log.d(TAG, "main display iface num is " + display_iface.length);
if(display_iface != null && display_iface.length > 0) {
m_main_iface = new int[display_iface.length];
for(int i = 0; i < m_main_iface.length; i++) {
if(DBG) Log.d(TAG, display_iface[i]);
m_main_iface[i] = ifacetotype(display_iface[i]);
}
}
else
m_main_iface = null;
} catch (Exception e) {
Log.e(TAG, "Error listing main interfaces :" + e);
}
try {
// Get aux display interface
String[] display_iface = mService.listInterfaces(AUX_DISPLAY);
if(DBG) Log.d(TAG, "aux display iface num is " + display_iface.length);
if(display_iface != null && display_iface.length > 0) {
m_aux_iface = new int[display_iface.length];
for(int i = 0; i < m_aux_iface.length; i++) {
if(DBG) Log.d(TAG, display_iface[i]);
m_aux_iface[i] = ifacetotype(display_iface[i]);
}
}
else
m_aux_iface = null;
} catch (Exception e) {
Log.e(TAG, "Error listing aux interfaces :" + e);
}
if (m_main_iface == null && m_aux_iface == null)
Log.e(TAG, "There is no display interface.");
//throw new IllegalArgumentException("There is no display interface.");
}
private int ifacetotype(String iface) {
int ifaceType;
if(iface.equals(DISPLAY_TYPE_TV)) {
ifaceType = DISPLAY_IFACE_TV;
} else if(iface.equals(DISPLAY_TYPE_YPbPr)) {
ifaceType = DISPLAY_IFACE_YPbPr;
} else if(iface.equals(DISPLAY_TYPE_VGA)) {
ifaceType = DISPLAY_IFACE_VGA;
} else if(iface.equals(DISPLAY_TYPE_HDMI)) {
ifaceType = DISPLAY_IFACE_HDMI;
} else if(iface.equals(DISPLAY_TYPE_LCD)) {
ifaceType = DISPLAY_IFACE_LCD;
} else {
ifaceType = 0;
}
return ifaceType;
}
private String typetoface(int type) {
String iface;
if(type == DISPLAY_IFACE_TV)
iface = DISPLAY_TYPE_TV;
else if(type == DISPLAY_IFACE_YPbPr)
iface = DISPLAY_TYPE_YPbPr;
else if(type == DISPLAY_IFACE_VGA)
iface = DISPLAY_TYPE_VGA;
else if(type == DISPLAY_IFACE_HDMI)
iface = DISPLAY_TYPE_HDMI;
else if(type == DISPLAY_IFACE_LCD)
iface = DISPLAY_TYPE_LCD;
else
return null;
return iface;
}
/**
*
* @return
* @hide
*/
public int getDisplayNumber() {
int number = 0;
if(m_main_iface != null)
number = 1;
if(m_aux_iface != null)
number = 2;
return number;
}
/**
*
* @param display
* @return
* @hide
*/
public int[] getIfaceList(int display) {
if(display == MAIN_DISPLAY)
return m_main_iface;
else if(display == AUX_DISPLAY)
return m_aux_iface;
else
return null;
}
/**
*
* @param display
* @return
* @hide
*/
public int getCurrentInterface(int display) {
try {
String iface = mService.getCurrentInterface(display);
return ifacetotype(iface);
} catch (Exception e) {
Log.e(TAG, "Error get current Interface :" + e);
return 0;
}
}
/**
*
* @param display
* @param type
* @return
* @hide
*/
public String[] getModeList(int display, int type) {
String iface = typetoface(type);
if(iface.equals(null))
return null;
try {
return mService.getModelist(display, iface);
} catch (Exception e) {
Log.e(TAG, "Error get list mode :" + e);
return null;
}
}
/**
*
* @param display
* @param type
* @return
* @hide
*/
public String getCurrentMode(int display, int type) {
String iface = typetoface(type);
if(iface.equals(null))
return null;
try {
return mService.getMode(display, iface);
} catch (Exception e) {
Log.e(TAG, "Error get current mode :" + e);
return null;
}
}
/**
*
* @param display
* @param type
* @param enable
* @hide
*/
public void setInterface(int display, int type, boolean enable ) {
try {
String iface = typetoface(type);
if(iface.equals(null))
return;
mService.enableInterface(display, iface, enable);
} catch (Exception e) {
Log.e(TAG, "Error set interface :" + e);
return;
}
}
/**
*
* @param display
* @param type
* @param mode
* @hide
*/
public void setMode(int display, int type, String mode) {
String iface = typetoface(type);
if(iface.equals(null))
return;
try {
mService.setMode(display, iface, mode);
if(display == MAIN_DISPLAY) {
int m, n;
int div = mode.indexOf('x');
if (div <= 0 || div >= (mode.length()-1)) {
Log.e(TAG, "Error: bad size " + mode);
return;
}
int div2 = mode.indexOf('p');
if (div2 <= 0 || div2 >= (mode.length()-1)) {
div2 = mode.indexOf('i');
if (div2 <= 0 || div2 >= (mode.length()-1)) {
Log.e(TAG, "Error: bad size " + mode);
return;
}
}
String mstr = mode.substring(0, div);
String nstr = mode.substring(div+1, div2);
try {
m = Integer.parseInt(mstr);
n = Integer.parseInt(nstr);
} catch (NumberFormatException e) {
Log.e(TAG, "Error: bad number " + e);
return;
}
Log.d(TAG, "set display size " + m +" " + n);
if(setWMDisplaySize(display, m, n) == 0) {
// setDisplaySize(MAIN_DISPLAY, m, n);
}
}
} catch (Exception e) {
Log.e(TAG, "Error set mode :" + e);
return;
}
}
/**
*
* @return
* @hide
*/
public boolean getUtils() {
String enable;
try {
enable = mService.getEnableSwitchFB();
} catch (Exception e) {
Log.e(TAG, "Error getUtils :" + e);
return false;
}
if(enable.equals("true"))
return true;
else
return false;
}
/**
* @hide
*/
public void switchNextDisplayInterface() {
try {
mService.switchNextDisplayInterface(MAIN_DISPLAY);
} catch (Exception e) {
Log.e(TAG, "Error set interface :" + e);
return;
}
}
/**
*
* @param display
* @param direction
* @param value
* @hide
*/
public void setOverScan(int display, int direction, int value) {
try {
mService.setScreenScale(display, direction, value);
// if(display == MAIN_DISPLAY) {
// Rect rect = getOverScan(MAIN_DISPLAY);
// if(direction == DISPLAY_OVERSCAN_X) {
// rect.left = value;
// rect.right = value;
// } else if(direction == DISPLAY_OVERSCAN_Y) {
// rect.top = value;
// rect.bottom = value;
// } else if(direction == DISPLAY_OVERSCAN_LEFT)
// rect.left = value;
// else if(direction == DISPLAY_OVERSCAN_RIGHT)
// rect.right = value;
// else if(direction == DISPLAY_OVERSCAN_TOP)
// rect.top = value;
// else if(direction == DISPLAY_OVERSCAN_BOTTOM)
// rect.bottom = value;
// mWM.setOverscan(Display.DEFAULT_DISPLAY, rect.left, rect.top, rect.right, rect.bottom);
// }
}catch (Exception e) {
Log.e(TAG, "Error setScreenScale :" + e);
return;
}
}
/**
*
* @param display
* @return
* @hide
*/
public Rect getOverScan(int display) {
String OverScan;
if(display == MAIN_DISPLAY)
OverScan = SystemProperties.get("persist.sys.overscan.main");
else if(display == AUX_DISPLAY)
OverScan = SystemProperties.get("persist.sys.overscan.aux");
else {
return new Rect(100,100,100,100);
}
String split = OverScan.substring(9);
String [] value = split.split("\\,");
if (value != null) {
Rect rect = new Rect();
rect.left = Integer.parseInt(value[0]);
rect.top = Integer.parseInt(value[1]);
rect.right = Integer.parseInt(value[2]);
rect.bottom = Integer.parseInt(value[3]);
return rect;
}
return new Rect(100,100,100,100);
}
/**
*
* @param display
* @param width
* @param height
* @hide
*/
public void setDisplaySize(int display, int width, int height)
{
String displaypolicy = SystemProperties.get("persist.sys.display.policy", "manual");
if(displaypolicy.equals("auto") == true) {
if (width >= 0 && height >= 0) {
try {
Log.d(TAG, "setDisplaySize " + display + " " + width + " " + height);
mService.setDisplaySize(display, width, height);
} catch (RemoteException e) {
Log.e(TAG, "Error setFramebufferSize :" + e);
}
}
}
}
private int setWMDisplaySize(int display, int width, int height)
{
String displaypolicy = SystemProperties.get("persist.sys.display.policy", "manual");
if(displaypolicy.equals("manual") == true)
return -1;
if (mWM == null) {
Log.e(TAG, "Error setDisplaySize get widow manager");
return -1;
}
try {
if (width >= 0 && height >= 0) {
mWM.setForcedDisplaySize(display, width, height);
return 0;
} else {
mWM.clearForcedDisplaySize(display);
return -1;
}
} catch (RemoteException e) {
Log.e(TAG, "Error setDisplaySize :" + e);
}
return 0;
}
/**
*
* @param display
* @param type
* @return
* @hide
*/
public int get3DModes(int display, int type)
{
String iface = typetoface(type);
if(iface.equals(null))
return 0;
try {
return mService.get3DModes(display, iface);
} catch (Exception e) {
Log.e(TAG, "Error get 3d modes :" + e);
return 0;
}
}
/**
*
* @param display
* @param type
* @return
* @hide
*/
public int getCur3DMode(int display, int type)
{
String iface = typetoface(type);
if(iface.equals(null))
return -1;
try {
return mService.getCur3DMode(display, iface);
} catch (Exception e) {
Log.e(TAG, "Error get cur 3d mode :" + e);
return -1;
}
}
/**
*
* @param display
* @param type
* @param mode
* @hide
*/
public void set3DMode(int display, int type, int mode)
{
String iface = typetoface(type);
if(iface.equals(null))
return;
try {
mService.set3DMode(display, iface, mode);
} catch (Exception e) {
Log.e(TAG, "Error set 3d modes :" + e);
return;
}
}
/**
*
* @return
* @hide
*/
public int saveConfig()
{
try {
return mService.saveConfig();
} catch (Exception e) {
Log.e(TAG, "Error save :" + e);
return -1;
}
}
/*
* brightness: [-128, 127], default 0
*/
/**
*
* @param display
* @param brightness
* @return
* @hide
*/
public int setBrightness(int display, int brightness)
{
if (brightness < -32 || brightness > 31) {
Log.e(TAG, "setBrightness out of range " + brightness);
return -1;
}
try {
mService.setBrightness(display, brightness);
} catch (Exception e) {
Log.e(TAG, "Error set brightness :" + e);
return -1;
}
return 0;
}
/*
* contrast: [0, 1.992], default 1;
*/
/**
*
* @param display
* @param contrast
* @return
* @hide
*/
public int setContrast(int display, float contrast)
{
if (contrast < 0 || contrast > 1.992) {
Log.e(TAG, "setContrast out of range " + contrast);
return -1;
}
try {
mService.setContrast(display, contrast);
} catch (Exception e) {
Log.e(TAG, "Error set Contrast :" + e);
return -1;
}
return 0;
}
/*
* saturation: [0, 1.992], default 1;
*/
/**
*
* @param display
* @param saturation
* @return
* @hide
*/
public int setSaturation(int display, float saturation)
{
if (saturation < 0 || saturation > 1.992) {
Log.e(TAG, "setContrast out of range " + saturation);
return -1;
}
try {
mService.setSaturation(display, saturation);
} catch (Exception e) {
Log.e(TAG, "Error set sat_con :" + e);
return -1;
}
return 0;
}
/*
* degree: [-30, 30], default 0
*/
/**
*
* @param display
* @param degree
* @return
* @hide
*/
public int setHue(int display, float degree)
{
if (degree < -30 || degree > 30) {
Log.e(TAG, "Error set hue out of range " + degree);
return -1;
}
try {
mService.setHue(display, degree);
} catch (Exception e) {
Log.e(TAG, "Error set hue :" + e);
return -1;
}
return 0;
}
}
/* $_FOR_ROCKCHIP_RBOX_$ */
//$_rbox_$_modify_$_zhengyang_20120220: AIDL file for rbox android display management service.
/* //device/java/android/android/os/IDisplayDeviceManagementService.aidl
**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package android.os;
/**
* @hide
*/
interface IDisplayDeviceManagementService
{
/**
** GENERAL
**/
/**
* Returns a list of currently known display interfaces
*/
String[] listInterfaces(int display);
/**
* Returns the current enabled display interfaces
*/
String getCurrentInterface(int display);
/**
* Returns a list of supported display modes
*/
String[] getModelist(int display, String iface);
/**
* Returns current display mode
*/
String getMode(int display, String iface);
/**
* Enable selected display interface
*/
void enableInterface(int display, String iface, boolean enable);
/**
* Set display mode
*/
void setMode(int display, String iface, String mode);
/**
* Switch next display interface
*/
void switchNextDisplayInterface(int display);
/**
* Get siwtch framebuffer info
*/
String getEnableSwitchFB();
/**
* Set display screen scale value
*/
void setScreenScale(int display, int direction, int value);
/**
* Switch framebuffer
*/
void setDisplaySize(int display, int width, int height);
/**
* Get Supported 3D Modes
*/
int get3DModes(int display, String iface);
/**
* Get Current 3D Mode
*/
int getCur3DMode(int display, String iface);
/**
* Set 3D Mode
*/
void set3DMode(int display, String iface, int mode);
/**
* saveConfig
*/
int saveConfig();
/**
* Set brightness
*/
void setBrightness(int display, int brightness);
/**
* Set contrast
*/
void setContrast(int display, float contrast);
/**
*Set saturation
*/
void setSaturation(int display, float saturation);
/**
*Set Hue
*/
void setHue(int display, float degree);
}
package com.android.server;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import android.app.ActivityManagerNative;
import android.content.Context;
import android.content.Intent;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.Slog;
import android.media.AudioManager;
public class AudioCommon {
private static final String TAG = AudioCommon.class.getSimpleName();
public static final String AUDIOPCMLISTUPDATE = "com.android.server.audiopcmlistupdate";
public static final String HW_AUDIO_CURRENTPLAYBACK = "persist.audio.currentplayback";
public static final String HW_AUDIO_CURRENTCAPTURE = "persist.audio.currentcapture";
public static final String HW_AUDIO_LASTSOCPLAYBACK = "persist.audio.lastsocplayback";
public static final String HW_AUDIO_SPDIF_MUTE = "persist.audio.spdif.mute";
public static final String HW_AUDIO_HDMI_MUTE = "persist.audio.hdmi.mute";
public static final String HW_AUDIO_HDMI_BITSTREAM_CHANNELS = "persist.audio.hdmi.channels";
public static final String MEDIA_CFG_AUDIO_BYPASS = "media.cfg.audio.bypass";
public static final String HW_AUDIO_HDMI_BYPASS = "persist.audio.hdmi.bypass";
public static final String HW_AUDIO_SPDIF_BYPASS = "persist.audio.spdif.bypass";
public static final String HW_AUDIO_HDMI_AUTO_IDENTIFY = "persist.audio.hdmi.autoidentify";
public static final String SOC_DEFAULT_KEY = "0";
public static final String SOC_AND_SPDIF_KEY = "9";
public static final String SPDIF_PASSTHROUGH_KEY = "8";
public static final String HDMI_MULTICHANNEL_KEY = "7";
public static final String HDMI_PASSTHROUGH_KEY = "6";
private static final String USB_AUDIO_PLAYBACK_SWITCH_STATE_FILE = "/sys/class/switch/usb_audio_playback/state";
private static final String USB_AUDIO_CAPTURE_SWITCH_STATE_FILE = "/sys/class/switch/usb_audio_capture/state";
public static final int SND_DEV_TYPE_BASE = 0;
public static final int SND_DEV_TYPE_USB = SND_DEV_TYPE_BASE + 1;
public static final int SND_DEV_TYPE_SPDIF = SND_DEV_TYPE_BASE + 2;
public static final int SND_DEV_TYPE_SOC_SPDIF = SND_DEV_TYPE_BASE + 3;
public static final int SND_DEV_TYPE_HDMI_MULTILPCM = SND_DEV_TYPE_BASE + 4;
public static final int SND_DEV_TYPE_HDMI_PASSTHROUGH = SND_DEV_TYPE_BASE + 5;
public static final int SND_DEV_TYPE_SPDIF_PASSTHROUGH = SND_DEV_TYPE_BASE + 6;
public static final int SND_DEV_TYPE_DEFAULT = SND_DEV_TYPE_BASE;
public static final int SND_PCM_STREAM_PLAYBACK = 0;
public static final int SND_PCM_STREAM_CAPTURE = 1;
public static final int SND_DEVICE_MODE_BASE = 0;
public static final int SND_DEVICE_MUTE = SND_DEVICE_MODE_BASE + 1;
public static final int SND_DEVICE_PCM = SND_DEVICE_MODE_BASE +2;
public static final int SND_DEVICE_BITSTREAM = SND_DEVICE_MODE_BASE + 3;
public static final int SND_DEVICE_BITSTREAM_5POINT1 = SND_DEVICE_MODE_BASE + 4;
public static final int SND_DEVICE_BITSTREAM_7POINT1 = SND_DEVICE_MODE_BASE + 5;
public static final int SND_DEVICE_AUTO_IDENTIFY = SND_DEVICE_MODE_BASE + 6;
public static final int SND_DEVICE_MANUAL_IDENTIFY = SND_DEVICE_MODE_BASE + 7;
private static AudioManager mAudioManager = null;
/*
* at the moment ,if the audio device is not usb audio. we recorgnise it as
* soc audio device. soc audio must be at the "0" place.
*/
public static String getCurrentPlaybackDevice() {
// Slog.v(TAG, "mCurPlaybackDevice: "+mCurPlaybackDevice);
// return mCurPlaybackDevice;
return SystemProperties.get(HW_AUDIO_CURRENTPLAYBACK, "0");
}
public static String getCurrentCaptureDevice() {
// Slog.v(TAG, "mCurCaptureDevice: "+mCurCaptureDevice);
// return mCurCaptureDevice;
return SystemProperties.get(HW_AUDIO_CURRENTCAPTURE, "0");
}
public static void setCurrentPlaybackDevice(String str) {
// WiredAccessoryObserver.mCurPlaybackDevice = str;
SystemProperties.set(HW_AUDIO_CURRENTPLAYBACK, str);
}
public static void setCurrentCaptureDevice(String str) {
// mCurCaptureDevice = str;
SystemProperties.set(HW_AUDIO_CURRENTCAPTURE, str);
}
public static void setLastSocPlayback(String str) {
SystemProperties.set(HW_AUDIO_LASTSOCPLAYBACK, str);
}
public static String getLastSocPlayback() {
return SystemProperties.get(HW_AUDIO_LASTSOCPLAYBACK, "0");
}
public static void setDeviceConnectionState(Context ctx, int device,
int state) {
if (mAudioManager == null)
mAudioManager = (AudioManager) ctx
.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setWiredDeviceConnectionState(device, state, "", "");
}
public static boolean isHdmiAutoIdentify() {
if(SystemProperties.get(HW_AUDIO_HDMI_AUTO_IDENTIFY, "false").equals("true"))
return true;
else
return false;
}
public static int getHdmiOutputMode() {
if (SystemProperties.get(HW_AUDIO_HDMI_MUTE, "false").equals("true")) {
return SND_DEVICE_MUTE;
} else if (SystemProperties.get(HW_AUDIO_HDMI_BYPASS,"false").equals("true")) {
if (SystemProperties.get(HW_AUDIO_HDMI_BITSTREAM_CHANNELS, "7.1").equals("5.1"))
return SND_DEVICE_BITSTREAM_5POINT1;
else if (SystemProperties.get(HW_AUDIO_HDMI_BITSTREAM_CHANNELS, "7.1").equals("7.1"))
return SND_DEVICE_BITSTREAM_7POINT1;
} else if (SystemProperties.get(HW_AUDIO_HDMI_BYPASS,"false").equals("false")) {
return SND_DEVICE_PCM;
}
return SND_DEVICE_MODE_BASE;
}
public static void setHdmiOutputMode(Context ctx, int mode) {
switch (mode) {
case SND_DEVICE_MUTE:
SystemProperties.set(HW_AUDIO_HDMI_MUTE, "true");
break;
case SND_DEVICE_PCM:
SystemProperties.set(HW_AUDIO_HDMI_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "false");
SystemProperties.set(HW_AUDIO_HDMI_BYPASS, "false");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_DEFAULT, SND_PCM_STREAM_PLAYBACK, "0");
break;
case SND_DEVICE_BITSTREAM_5POINT1:
SystemProperties.set(HW_AUDIO_HDMI_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_BITSTREAM_CHANNELS, "5.1");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_HDMI_PASSTHROUGH, SND_PCM_STREAM_PLAYBACK, HDMI_PASSTHROUGH_KEY);
break;
case SND_DEVICE_BITSTREAM_7POINT1:
SystemProperties.set(HW_AUDIO_HDMI_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_BITSTREAM_CHANNELS, "7.1");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_HDMI_PASSTHROUGH, SND_PCM_STREAM_PLAYBACK, HDMI_PASSTHROUGH_KEY);
break;
case SND_DEVICE_AUTO_IDENTIFY:
SystemProperties.set(HW_AUDIO_HDMI_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_BYPASS, "true");
SystemProperties.set(HW_AUDIO_HDMI_AUTO_IDENTIFY, "true");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_HDMI_PASSTHROUGH, SND_PCM_STREAM_PLAYBACK, HDMI_PASSTHROUGH_KEY);
break;
case SND_DEVICE_MANUAL_IDENTIFY:
SystemProperties.set(HW_AUDIO_HDMI_AUTO_IDENTIFY, "false");
default:
break;
}
}
public static int getSpdifOutputMode() {
if (SystemProperties.get(HW_AUDIO_SPDIF_MUTE, "false").equals("true"))
return SND_DEVICE_MUTE;
else if (SystemProperties.get(HW_AUDIO_SPDIF_BYPASS, "false").equals("false"))
return SND_DEVICE_PCM;
else if (SystemProperties.get(HW_AUDIO_SPDIF_BYPASS, "false").equals("true"))
return SND_DEVICE_BITSTREAM;
return SND_DEVICE_MODE_BASE;
}
public static void setSpdifOutputMode(Context ctx, int mode) {
switch (mode) {
case SND_DEVICE_MUTE:
SystemProperties.set(HW_AUDIO_SPDIF_MUTE, "true");
break;
case SND_DEVICE_PCM:
SystemProperties.set(HW_AUDIO_SPDIF_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "false");
SystemProperties.set(HW_AUDIO_SPDIF_BYPASS, "false");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_DEFAULT, SND_PCM_STREAM_PLAYBACK, "0");
break;
case SND_DEVICE_BITSTREAM:
SystemProperties.set(HW_AUDIO_SPDIF_MUTE, "false");
SystemProperties.set(MEDIA_CFG_AUDIO_BYPASS, "true");
SystemProperties.set(HW_AUDIO_SPDIF_BYPASS, "true");
doAudioDevicesRouting(ctx, SND_DEV_TYPE_SPDIF_PASSTHROUGH, SND_PCM_STREAM_PLAYBACK, SPDIF_PASSTHROUGH_KEY);
break;
default:
break;
}
}
public static boolean hasSpdif(){
boolean hasspdif = false;
String CardsPath = "/proc/asound/cards";
FileReader cards_fr = null;
BufferedReader cards_br = null;
try {
try {
cards_fr = new FileReader(CardsPath);
} catch (FileNotFoundException e) {
// TODO: handle exception
e.printStackTrace();
}
cards_br = new BufferedReader(cards_fr);
String Line;
// cards
while ((Line = cards_br.readLine()) != null) {
int pos = Line.lastIndexOf(" - ");
if (pos > 0) {
pos = Line.indexOf("SPDIF");
if (pos > 0) {
hasspdif = true;
break;
}
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (cards_br != null)
cards_br.close();
if (cards_fr != null)
cards_fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return hasspdif;
}
/*
* currently, we just deal with usb audio, spdif devices routing. ofcourse,
* it can be extended.
*/
public static void doAudioDevicesRouting(Context ctx, int deviceType,
int streamType, String state) {
switch (deviceType) {
case SND_DEV_TYPE_SPDIF_PASSTHROUGH:
//doUsbAudioDevicesRouting(streamType, "-1");
if (streamType == SND_PCM_STREAM_PLAYBACK) {
setDeviceConnectionState(ctx, AudioManager.DEVICE_OUT_AUX_DIGITAL, 0);
setDeviceConnectionState(ctx, AudioManager.DEVICE_OUT_SPDIF, 1);
setLastSocPlayback(state);
}
break;
case SND_DEV_TYPE_HDMI_PASSTHROUGH:
if(streamType == SND_PCM_STREAM_PLAYBACK){
setDeviceConnectionState(ctx,AudioManager.DEVICE_OUT_SPDIF, 0);
setDeviceConnectionState(ctx,AudioManager.DEVICE_OUT_AUX_DIGITAL, 1);
setLastSocPlayback(state);
}
break;
case SND_DEV_TYPE_HDMI_MULTILPCM:
if(streamType == SND_PCM_STREAM_PLAYBACK){
setDeviceConnectionState(ctx,AudioManager.DEVICE_OUT_SPDIF, 0);
setDeviceConnectionState(ctx,
AudioManager.DEVICE_OUT_AUX_DIGITAL, 1);
setLastSocPlayback(state);
}
break;
default:
Slog.i(TAG, "Default");
if (streamType == SND_PCM_STREAM_PLAYBACK) {
int connected = 0;
if(hasSpdif()){
Slog.i(TAG, "has spdif.");
connected = 1;
}
setDeviceConnectionState(ctx,AudioManager.DEVICE_OUT_SPDIF, connected);
setDeviceConnectionState(ctx,
AudioManager.DEVICE_OUT_AUX_DIGITAL, 1);
setLastSocPlayback(state);
}
break;
}
if (deviceType == SND_DEV_TYPE_DEFAULT)
setCurrentPlaybackDevice("0");
else
setCurrentPlaybackDevice(state);
ActivityManagerNative.broadcastStickyIntent(new Intent(
AUDIOPCMLISTUPDATE), null, UserHandle.USER_ALL);
}
public static void doUsbAudioDevicesRouting(int streamType, String state) {
FileWriter fw;
int card = Integer.parseInt(state);
if (card > 0)
card = card * 10;
state = Integer.toString(card);
switch (streamType) {
case SND_PCM_STREAM_PLAYBACK:
try {
fw = new FileWriter(USB_AUDIO_PLAYBACK_SWITCH_STATE_FILE);
fw.write(state);
fw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
break;
case SND_PCM_STREAM_CAPTURE:
try {
fw = new FileWriter(USB_AUDIO_CAPTURE_SWITCH_STATE_FILE);
fw.write(state);
fw.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
break;
default:
Slog.e(TAG, "unknown exception!");
break;
}
}
}
/*
* Copyright (C) 2013-2014 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nxp.intf;
import android.os.Bundle;
/**
* {@hide}
*/
interface IJcopService {
/* JCOP Service API */
int jcopOsDownload(in String pkg);
}
/*
* Copyright (C) 2013-2014 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nxp.intf;
import android.os.Bundle;
/**
* {@hide}
*/
interface ILoaderService {
/* Applet load applet API */
int appletLoadApplet(in String pkg, in String choice);
int getListofApplets(in String pkg, out String[] name);
byte[] getKeyCertificate();
byte[] lsExecuteScript(in String srcIn, in String rspOut);
byte[] lsGetVersion();
}
/*
* Copyright (C) 2013-2014 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nxp.intf;
import android.os.Bundle;
/**
* {@hide}
*/
interface INxpExtrasService{
Bundle open(in String pkg, IBinder b);
Bundle close(in String pkg, IBinder b);
Bundle transceive(in String pkg, in byte[] data_in);
byte[] getSecureElementUid(String pkg);
boolean isEnabled();
}
/*
* Copyright (C) 2013-2014 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nxp.intf;
import com.nxp.intf.INxpExtrasService;
import com.nxp.intf.ILoaderService;
import com.nxp.intf.IJcopService;
/**
* {@hide}
*/
interface IeSEClientServicesAdapter {
INxpExtrasService getNxpExtrasService();
ILoaderService getLoaderService();
IJcopService getJcopService();
}
\ No newline at end of file
/*
* Copyright (C) 2015 NXP Semiconductors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nxp.nfc;
/**
* {@hide}
*/
interface INfcDta {
/* DTA API */
boolean snepDtaCmd(in String cmdType, in String serviceName, in int serviceSap, in int miu, in int rwSize, in int testCaseId);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment