Loading src/java/com/android/internal/telephony/gsm/SmsCbHeader.java +39 −36 Original line number Diff line number Diff line Loading @@ -95,17 +95,22 @@ class SmsCbHeader { throw new IllegalArgumentException("Illegal PDU"); } if (pdu.length <= PDU_LENGTH_ETWS) { format = FORMAT_ETWS_PRIMARY; geographicalScope = (pdu[0] & 0xc0) >> 6; if (pdu.length <= PDU_LENGTH_GSM) { // can be ETWS or GSM format. // Per TS23.041 9.4.1.2 and 9.4.1.3.2, GSM and ETWS format both // contain serial number which contains GS, Message Code, and Update Number // per 9.4.1.2.1, and message identifier in same octets geographicalScope = (pdu[0] & 0xc0) >>> 6; serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff); messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff); if (isEtwsMessage() && pdu.length <= PDU_LENGTH_ETWS) { format = FORMAT_ETWS_PRIMARY; dataCodingScheme = -1; pageIndex = -1; nrOfPages = -1; boolean emergencyUserAlert = (pdu[4] & 0x1) != 0; boolean activatePopup = (pdu[5] & 0x80) != 0; int warningType = (pdu[4] & 0xfe) >> 1; int warningType = (pdu[4] & 0xfe) >>> 1; byte[] warningSecurityInfo; // copy the Warning-Security-Information, if present if (pdu.length > PDU_HEADER_LENGTH) { Loading @@ -117,16 +122,13 @@ class SmsCbHeader { warningSecurityInfo); mCmasInfo = null; return; // skip the ETWS/CMAS initialization code for regular notifications } else if (pdu.length <= PDU_LENGTH_GSM) { } else { // GSM pdus are no more than 88 bytes format = FORMAT_GSM; geographicalScope = (pdu[0] & 0xc0) >> 6; serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff); messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff); dataCodingScheme = pdu[4] & 0xff; // Check for invalid page parameter int pageIndex = (pdu[5] & 0xf0) >> 4; int pageIndex = (pdu[5] & 0xf0) >>> 4; int nrOfPages = pdu[5] & 0x0f; if (pageIndex == 0 || nrOfPages == 0 || pageIndex > nrOfPages) { Loading @@ -136,6 +138,7 @@ class SmsCbHeader { this.pageIndex = pageIndex; this.nrOfPages = nrOfPages; } } else { // UMTS pdus are always at least 90 bytes since the payload includes // a number-of-pages octet and also one length octet per page Loading @@ -148,7 +151,7 @@ class SmsCbHeader { } messageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff; geographicalScope = (pdu[3] & 0xc0) >> 6; geographicalScope = (pdu[3] & 0xc0) >>> 6; serialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff); dataCodingScheme = pdu[5] & 0xff; Loading Loading
src/java/com/android/internal/telephony/gsm/SmsCbHeader.java +39 −36 Original line number Diff line number Diff line Loading @@ -95,17 +95,22 @@ class SmsCbHeader { throw new IllegalArgumentException("Illegal PDU"); } if (pdu.length <= PDU_LENGTH_ETWS) { format = FORMAT_ETWS_PRIMARY; geographicalScope = (pdu[0] & 0xc0) >> 6; if (pdu.length <= PDU_LENGTH_GSM) { // can be ETWS or GSM format. // Per TS23.041 9.4.1.2 and 9.4.1.3.2, GSM and ETWS format both // contain serial number which contains GS, Message Code, and Update Number // per 9.4.1.2.1, and message identifier in same octets geographicalScope = (pdu[0] & 0xc0) >>> 6; serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff); messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff); if (isEtwsMessage() && pdu.length <= PDU_LENGTH_ETWS) { format = FORMAT_ETWS_PRIMARY; dataCodingScheme = -1; pageIndex = -1; nrOfPages = -1; boolean emergencyUserAlert = (pdu[4] & 0x1) != 0; boolean activatePopup = (pdu[5] & 0x80) != 0; int warningType = (pdu[4] & 0xfe) >> 1; int warningType = (pdu[4] & 0xfe) >>> 1; byte[] warningSecurityInfo; // copy the Warning-Security-Information, if present if (pdu.length > PDU_HEADER_LENGTH) { Loading @@ -117,16 +122,13 @@ class SmsCbHeader { warningSecurityInfo); mCmasInfo = null; return; // skip the ETWS/CMAS initialization code for regular notifications } else if (pdu.length <= PDU_LENGTH_GSM) { } else { // GSM pdus are no more than 88 bytes format = FORMAT_GSM; geographicalScope = (pdu[0] & 0xc0) >> 6; serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff); messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff); dataCodingScheme = pdu[4] & 0xff; // Check for invalid page parameter int pageIndex = (pdu[5] & 0xf0) >> 4; int pageIndex = (pdu[5] & 0xf0) >>> 4; int nrOfPages = pdu[5] & 0x0f; if (pageIndex == 0 || nrOfPages == 0 || pageIndex > nrOfPages) { Loading @@ -136,6 +138,7 @@ class SmsCbHeader { this.pageIndex = pageIndex; this.nrOfPages = nrOfPages; } } else { // UMTS pdus are always at least 90 bytes since the payload includes // a number-of-pages octet and also one length octet per page Loading @@ -148,7 +151,7 @@ class SmsCbHeader { } messageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff; geographicalScope = (pdu[3] & 0xc0) >> 6; geographicalScope = (pdu[3] & 0xc0) >>> 6; serialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff); dataCodingScheme = pdu[5] & 0xff; Loading