AppUpdateManagerFactory.create

This hook has nothing to do with privacy: it prevents apps from detecting that a new update is available on the Play Store. That should take care of the nagging about "upgrading". It only is effective on apps that use the Play Services' AppUpdateManager. Warning: you may miss important updates when using this hook. ★★★ XPrivacyLua 1.26 or later is required starting with version 2 of the hook. ★★★ Instructions: 1. Download this hook. 2. Make sure that the Fif collection is enabled in XPL Pro. 3.a. In XPL, enable the (new) "Get app updates" group for apps you want to prevent from getting update information. 3.b. Or, in XPL Pro, enable the AppUpdateManagerFactory.create hook. Changelog: v2 - 2019-11-15 Fix hangs on some apps. Requires XPrivacyLua 1.26 or later. v1 - 2019-11-10 First public release.

CollectionFif
GroupGet app updates
NameAppUpdateManagerFactory.create
AuthorFif_ on XDA
Version2
Updated (UTC)2019-11-15 08:45:08
Created (UTC)2019-11-11 00:48:02
Downloads794
Class namecom.google.android.play.core.appupdate.AppUpdateManagerFactory
Method namecreate
Parameter typesandroid.content.Context
Return typecom.google.android.play.core.appupdate.AppUpdateManager
Min SDK0
Max SDK999
Min APK0
Max APK2147483647
Excluded packages-
EnabledYes
OptionalYes
UsageYes
NotifyNo
Settings-
-- AppUpdateManagerFactory.create is a Lua hook definition designed to work                     
-- with XPrivacyLua.

-- AppUpdateManagerFactory.create 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.

-- AppUpdateManagerFactory.create 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.

function after(h, param)
  local hooked = param:getValue('hooked-getAppUpdateInfo', this)
  if hooked then
    return false
  else
    param:putValue('hooked-getAppUpdateInfo', true, this)
    local appUpdateManager = param:getResult()
    hook(appUpdateManager, 'getAppUpdateInfo', getAppUpdateInfoHook)
    log('Hooked getAppUpdateInfo()')
    return true, 'Hooked getAppUpdateInfo()'
  end
end

function getAppUpdateInfoHook(when, param)
  if when == "after" then
    local hooked = param:getValue('hooked-Task-getResult', this)
    if hooked then
      return false
    else
      param:putValue('hooked-Task-getResult', true, this)
      local task = param:getResult()
      hook(task, 'getResult', getResultHook)
      log('Hooked Task::getResult()')
    end
  end
end

function getResultHook(when, param)
  if when == "after" then
    local hooked = param:getValue('hooked-AppUpdateInfo', this)
    if hooked then
      return false
    else
      param:putValue('hooked-AppUpdateInfo', true, this)
      local updateInfo = param:getResult()
      hook(updateInfo, 'availableVersionCode', appUpdateInfoHook, 'availableVersionCode', 0)
      hook(updateInfo, 'isUpdateTypeAllowed', appUpdateInfoHook, 'isUpdateTypeAllowed', false)
      hook(updateInfo, 'updateAvailability', appUpdateInfoHook, 'updateAvailability', 1)
      log('Hooked AppUpdateInfo')
    end
  end
end

function appUpdateInfoHook(when, param, name, fake)
  if when == "after" then
    local val = param:getResult()
    param:setResult(fake)
    log(name .. '() → ' .. tostring(fake) .. ' (was ' .. tostring(val) .. ')')
  end
end