TelephonyManager/getNetworkOperator

Replace the built-in hook to fake mcc and mnc with getNetworkOperator method,for gsm users only.Setting must match exactly like "MCC,MNC",for example,"460,00".If you want to get a fake location by Celluar,you should also download and enable my modified getCellLocation hook definition.

CollectionPrivacy
GroupUse.Tracking
NameTelephonyManager/getNetworkOperator
AuthorM66B,hKFirEs
Version4
Updated (UTC)2018-03-17 06:18:30
Created (UTC)2018-03-17 06:18:30
Downloads1496
Class nameandroid.telephony.TelephonyManager
Method namegetNetworkOperator
Parameter types
Return typejava.lang.String
Min SDK1
Max SDK999
Min APK0
Max APK2147483647
Excluded packages-
EnabledYes
OptionalNo
UsageYes
NotifyNo
SettingsMCC,MNC
-- This file is part of XPrivacyLua.

-- XPrivacyLua 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 3 of the License, or
-- (at your option) any later version.

-- XPrivacyLua 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 XPrivacyLua.  If not, see <http://www.gnu.org/licenses/>.

-- Copyright 2017-2018 Marcel Bokhorst (M66B)

function after(hook, param)
    local result = param:getResult()
    if result == nil then
        return false
    end

    local fake = '00101'

    local setting = param:getSetting("MCC,MNC")
    if setting == nil then
    	param:setResult(fake)
    	return true, result, fake
    end
	
    local index = string.find(setting,",",1,true)
    if index == nil then
    	param:setResult(fake)
    	return true, result, fake
    end
	
    local fakemcc = string.sub(setting,1,index-1)
    local fakemnc = string.sub(setting,index+1,-1)

    if tonumber(fakemcc) == nil or tonumber(fakemnc) == nil then
    	param:setResult(fake)
    	return true, result, fake
    end

    fake = fakemcc..fakemnc
    param:setResult(fake)
    return true, result, fake
end