Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cedd0910 authored by New Author Steven Liu's avatar New Author Steven Liu Committed by Android Git Automerger
Browse files

am 20bb1511: am 1f228230: am 1f560a73: am 0f840945: redirect RIL_UNSOL_OEM_HOOK_RAW to system app

* commit '20bb15116147edb3364f68f0b7f0d1a3cb588181':
  redirect RIL_UNSOL_OEM_HOOK_RAW to system app
parents dce711cd 8df71715
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -1094,6 +1094,30 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        }
        }
    }
    }


    public void notifyOemHookRawEventForSubscriber(long subId, byte[] rawData) {
        if (!checkNotifyPermission("notifyOemHookRawEventForSubscriber")) {
            return;
        }

        synchronized (mRecords) {
            for (Record r : mRecords) {
                if (VDBG) {
                    log("notifyOemHookRawEventForSubscriber:  r=" + r + " subId=" + subId);
                }
                if (((r.events & PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT) != 0) &&
                        ((r.subId == subId) ||
                        (r.subId == SubscriptionManager.DEFAULT_SUB_ID))) {
                    try {
                        r.callback.onOemHookRawEvent(rawData);
                    } catch (RemoteException ex) {
                        mRemoveList.add(r.binder);
                    }
                }
            }
            handleRemoveListLocked();
        }
    }

    @Override
    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
@@ -1303,6 +1327,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);
                    android.Manifest.permission.READ_PRECISE_PHONE_STATE, null);


        }
        }

        if ((events & PhoneStateListener.LISTEN_OEM_HOOK_RAW_EVENT) != 0) {
            mContext.enforceCallingOrSelfPermission(
                    android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, null);
        }
    }
    }


    private void handleRemoveListLocked() {
    private void handleRemoveListLocked() {
+26 −0
Original line number Original line Diff line number Diff line
@@ -214,6 +214,14 @@ public class PhoneStateListener {
     */
     */
    public static final int LISTEN_VOLTE_STATE                              = 0x00004000;
    public static final int LISTEN_VOLTE_STATE                              = 0x00004000;


    /**
     * Listen for OEM hook raw event
     *
     * @see #onOemHookRawEvent
     * @hide
     */
    public static final int LISTEN_OEM_HOOK_RAW_EVENT                       = 0x00008000;

     /*
     /*
     * Subscription used to listen to the phone state changes
     * Subscription used to listen to the phone state changes
     * @hide
     * @hide
@@ -314,6 +322,10 @@ public class PhoneStateListener {
                    case LISTEN_VOLTE_STATE:
                    case LISTEN_VOLTE_STATE:
                        PhoneStateListener.this.onVoLteServiceStateChanged((VoLteServiceState)msg.obj);
                        PhoneStateListener.this.onVoLteServiceStateChanged((VoLteServiceState)msg.obj);
                        break;
                        break;
                    case LISTEN_OEM_HOOK_RAW_EVENT:
                        PhoneStateListener.this.onOemHookRawEvent((byte[])msg.obj);
                        break;

                }
                }
            }
            }
        };
        };
@@ -481,6 +493,16 @@ public class PhoneStateListener {
    public void onVoLteServiceStateChanged(VoLteServiceState stateInfo) {
    public void onVoLteServiceStateChanged(VoLteServiceState stateInfo) {
    }
    }


    /**
     * Callback invoked when OEM hook raw event is received. Requires
     * the READ_PRIVILEGED_PHONE_STATE permission.
     * @param rawData is the byte array of the OEM hook raw data.
     * @hide
     */
    public void onOemHookRawEvent(byte[] rawData) {
        // default implementation empty
    }

    /**
    /**
     * The callback methods need to be called on the handler thread where
     * The callback methods need to be called on the handler thread where
     * this object was created.  If the binder did that for us it'd be nice.
     * this object was created.  If the binder did that for us it'd be nice.
@@ -553,6 +575,10 @@ public class PhoneStateListener {
        public void onVoLteServiceStateChanged(VoLteServiceState lteState) {
        public void onVoLteServiceStateChanged(VoLteServiceState lteState) {
            Message.obtain(mHandler, LISTEN_VOLTE_STATE, 0, 0, lteState).sendToTarget();
            Message.obtain(mHandler, LISTEN_VOLTE_STATE, 0, 0, lteState).sendToTarget();
        }
        }

        public void onOemHookRawEvent(byte[] rawData) {
            Message.obtain(mHandler, LISTEN_OEM_HOOK_RAW_EVENT, 0, 0, rawData).sendToTarget();
        }
    };
    };


    private void log(String s) {
    private void log(String s) {
+1 −0
Original line number Original line Diff line number Diff line
@@ -43,5 +43,6 @@ oneway interface IPhoneStateListener {
    void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState);
    void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState);
    void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo);
    void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo);
    void onVoLteServiceStateChanged(in VoLteServiceState lteState);
    void onVoLteServiceStateChanged(in VoLteServiceState lteState);
    void onOemHookRawEvent(in byte[] rawData);
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -62,4 +62,5 @@ interface ITelephonyRegistry {
    void notifyCellInfoForSubscriber(in long subId, in List<CellInfo> cellInfo);
    void notifyCellInfoForSubscriber(in long subId, in List<CellInfo> cellInfo);
    void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo);
    void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo);
    void notifyVoLteServiceStateChanged(in VoLteServiceState lteState);
    void notifyVoLteServiceStateChanged(in VoLteServiceState lteState);
    void notifyOemHookRawEventForSubscriber(in long subId, in byte[] rawData);
}
}